1 Reply Latest reply on Dec 2, 2007 7:23 PM by Newsgroup_User

    How to use URL in actionscript  Instead of services-config.xml?

    FredFlex
      Hi Alls,

      I would like to set my service's url in actionScript (I don't want to use compiler option -services witch need to recompile swf if you change service's url).

      I search for a long time on google but I found nothing, and adobe documentation isn't very clear.

      Thank for help!!!
        • 1. Re: How to use URL in actionscript  Instead ofservices-config.xml?
          Level 7
          If you are relying on a services-config.xml file, then this must be provided
          at compile time because the compiler uses it to generate code.

          If you're not using <mx:DataService>, you can actually avoid compiling against
          a services-config.xml file. This is because for the other services, such
          as <mx:RemoteObject> or <mx:WebService useProxy="true"> or <mx:HTTPService
          useProxy="true">, the main thing the compiler does from services-config.xml
          is to generate the code to instantiate the set of channels that should be
          used to contact a destination in LCDS.

          Well... you can do that programmatically in ActionScript... something like
          this:

          import mx.messaging.ChannelSet;
          import mx.messaging.channels.AMFChannel;

          ...

          private function channelInit():void
          {
          var channelSet:ChannelSet = new ChannelSet();
          var channel:AMFChannel = new AMFChannel(null, " http://{server.name}:{server.port}/mycontext/messagebroker/amf");
          channelSet.addChannel(channel);
          myRemoteObject.channelSet = channelSet;
          }

          Just make sure you call this initialization code before you make any service
          requests. If you're proxied WebServices, be sure that you use the ActionScript
          API instead of the MXML tag so that you can delay when loadWSDL() is called
          because you'll want to setup the channelSet first.

          Regards,
          Pete


          Hello FredFlex,

          > Hi Alls,
          >
          > I would like to set my service's url in actionScript (I don't want to
          > use compiler option -services witch need to recompile swf if you
          > change service's url).
          >
          > I search for a long time on google but I found nothing, and adobe
          > documentation isn't very clear.
          >
          > Thank for help!!!
          >