Archive

Archive for the ‘Actionscript’ Category

FLEX : Creating RemoteObject Channel Set for WEBORB or LCDS in ActionScript

March 2nd, 2009

I have been having some issues when running multiple WebOrb instances (usually because of a different authentication scheme) where if I start using one destination and then switch to another, my SWF gets confused, and dose no know which remote instance to get execute the remote object at.

To combat the issue, i started hard coding my channel information for each instance, and I honestly like it more. I no longer need to clean my projects every time I make a change, and I always know where my .swf is pointing.

Like it or leave it, here is how its done.

import mx.rpc.remoting.RemoteObject;
import mx.messaging.Channel;
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;

    private function init() : void {
        remoteObject  = new RemoteObject("GenericDestination");
        var cs:ChannelSet = new ChannelSet();
        var customChannel:Channel = new AMFChannel("my-channel", "http://myurl:80/WebOrbK/weborb.aspx");
        cs.addChannel(customChannel);
        remoteObject.channelSet = cs;
        remoteObject.destination = "my-destination";
        remoteObject.source = "MyNameSpace.MyClass";

        //Probably would add remote object listeners here.
        }

Greg Actionscript, FLEX, WEBORB