1 Reply Latest reply on Jan 9, 2008 5:34 AM by m_hartnett

    Dynamic HTTPService URL

    sakura102384
      How about when i wanted my HTTPService url to become dynamic that it gets from an external text file or xml file. Here is an exampl...

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:remoting="com.oreilly.
      programmingflex.rpc.*" layout="absolute" initialize="initializeHandler(event)">
      <mx:Script>
      <![CDATA[
      private function initializeHandler(event:Event):void {
      textService.send( );
      }
      private function resultHandler(event:Event):void {
      textArea.text = String(textService.lastResult);
      }
      ]]>
      </mx:Script>
      <!--<mx:HTTPService id="feedRequest" url="ip.txt" result="resultHandler(event)" useProxy="false"/>-->
      <mx:HTTPService id="textService" url=" http://www.yourdomainname.com/ip.xml" result="resultHandler(event)" />
      <mx:TextArea id="textArea" width="500"/>
      <mx:VideoDisplay id="vid" source="{textService.lastResult.subscribers.thevideo}" width="450" height="338" x="20" y="75" />
      </mx:Application>

      As you can see my HTTPService URL points to a file named ip.txt, the file includes my database URL where i will get my files to be played in my VideoDisplay. Is there anybody who can help me with this stuff. any reply would be very much appreciated. thanks!!!
        • 1. Re: Dynamic HTTPService URL
          m_hartnett Level 3
          Are you asking if you can make the URL property of the HTTPService that points to the textService dynamic?

          You can bind the property to some local variable that is dynamically built:

          <mx:HTTPService id="textService" url="{someXMLFilePath}" result="resultHandler(event)" />

          The someXMLFilePath variable can be built in the initializeHandler ( or where ever you want).