Flash Remoting (AS2) in Flash CS3

I’m surprised that while any sort of remote connection classes you could want are included in the core packages of ActionScript 3.0, if you are working with ActionScript 2.0 within Flash CS3, the classes you need are still not included under a default install. I’ve lamented this fact for years as it has held true each time Macromedia/Adobe releases a new version of the IDE. There may be an excellent reason for this but I do not know what it could be.

Flash CS3 does not include the NetConnection Debugger either. I’ve found that the simplest thing to do is to use the SWC files from Flash 8 alongside the NetConnectionDebugger.swf which is launched separately. It works quite well so I’ve packaged both an FLA with the Remoting SWC components along with the NetConnectionDebugger.swf which can all be used to get around the fact that none this vital stuff is shipped along with the new authoring environment.

Remoting Components

You can also download the unpackaged classes from here.

9 thoughts on “Flash Remoting (AS2) in Flash CS3”

  1. This sucks, as you mentioned no different in the previous versions.

    Instead of placing the Remoting Classes or swc in the default Flash classes directory we now place it in our own codebase repository.

  2. Hi,

    VERY VERY cool that you made this!

    I never worked with flash remoting before and I am looking at their tutorial.

    How can I make a new service with you component?
    this is the example they give with the old remoting, but I really have no clue how this will work with your component.If you could help me on the way with setting this up….wow it would be super great man!

    cheers

    Joris (Netherlands)

    [code]
    NetDebug.initialize();

    var service:Service = new Service(‘http://localhost/amfphp/gateway.php’, null, ‘com.company.MyService’);

    var pc:PendingCall = service.myService(“arg1”, {x:’myX’});
    pc.responder:RelayResponder = new RelayResponder(this, “onSuccess”, “onFault”);

    function onSuccess(re:ResultEvent)
    {
    var rs:RecordSet = RecordSet(re.result);
    myDatagrid.dataProvider = rs;
    }

    function onFault()
    {
    trace(“Fudge! :(“);
    }

    [/code]

  3. Hi Joris. That looks correct to me but I’d have to run a debug session to find out for sure. Do you get any error messages back? Are you using the NetConnection Debugger?

  4. Hi Joseph,

    Thank you very much for replying.

    Just to make sure that I do the right thing:

    I use flash CS 3 but export as flash 8 AS2.0

    the following errors are generated: “the class or interface “SERVICE” could not be loaded”, the sanme goes for the PENDINGCALL.

    Sorry to bother you man, I have never done this so how should I use your Debugger? Is there a help file somewhere I can read?

    MANY thanks!

    joris

  5. Hi,

    I managed to get the classes work!
    Download http://blog.vixiom.com/uploads/mx.zip for the classes.
    Put this mx folder in the same folder as the .fla and then just import them.

    This will generate 5 new errors WITHIN the rsDataFetcher.as and PendingCall.as.

    There is no method with the name ‘addEventListener’.
    Type mismatch in assignment statement: found mx.remoting.RsDataRange where mx.data.DataRange is required.
    There is no method with the name ‘requestRange’.
    There is no class or package with the name ‘mx.data.binding’ found in package ‘mx.data’.
    __service.log.logDebug(__service.name + “.”+ __methodName+ “() returned “+ mx.data.binding.ObjectDumper.toString( status ));

    this is the code that was given as an examle from amfphp:

    import mx.remoting.debug.NetDebug;
    import mx.remoting.*;
    import mx.rpc.*;
    NetDebug.initialize();

    var service:Service = new Service(‘http://localhost/amfphp/gateway.php’, null, ‘com.company.MyService’);

    var pc:PendingCall = service.myService(“arg1”, {x:’myX’});
    pc.responder= new RelayResponder(this, “onSuccess”, “onFault”);

    function onSuccess(re:ResultEvent) {
    var rs:RecordSet = RecordSet(re.result);
    myDatagrid.dataProvider = rs;
    }

    function onFault() {
    trace(“Fudge! :(“);
    }

Leave a Comment

Your email address will not be published. Required fields are marked *