2 Replies Latest reply on Jul 21, 2006 1:34 PM by KYAHN

    Redirecting a web service to a different URL

    KYAHN
      Hi guys, what I want to do is to make my URL property in my HTTPService tag to be dynamic so I can change it from outside everytime I call the MXML to load in the page.
      The example of Redirecting a web service to a different URL given in the help bugs me since I dont undertand how they exactly implement this within the code.

      Can anybody give me a more complete example of how to do this?
      Thank you
        • 1. Re: Redirecting a web service to a different URL
          upshotvideo Level 1
          You can make the url a variable. I set the url and make it send both in an AS function. so if the httpService id was myHS, in your AS Script above:


          public function send(var_name:String):void{
          myHS.url=var_name;
          myHS.send();
          }

          Then you can set the value of that vaiable from anywhere within the app, or through FlashVars.

          • 2. Redirecting a web service to a different URL
            KYAHN Level 1
            Thanks, i figured out the first part and now I have my URL dynamic, problem is: how do I set it from outside?

            If I do it from HTML:
            <embed src="integracionAs7.swf?elXml=hello.xml"...

            It doesnt work! I execute the htmnl and the warning comes out saying that the URL variable is null or something like that, so it's like the variable i'm trying to send to the SWF is not being recognized.

            I wrote this on my MXML:

            [Bindable] public var elXml:String;
            public function getNewFile(myUrl:String):void {
            myXml.url = myUrl;
            myXml.send();
            }

            The variable works if I set it from within the app, but I'm trying to do it from outside, can you tell me how to use FlashVars?

            Thanks!