Thank you, it does help it works now. Around midnight I downloaded the mxml/zip file on this page (http://blogs.adobe.com/flexdoc/2008/04/using_html_page_as_a_data_prov.html) and it describes exactly what you told me but thanks to you I now understand why it didn't work and now does.
Merrick --- In [email protected], "valdhor" <valdhorli...@...> wrote: > > Your problem is that you are invoking the service on creation complete > which is before the ID variable is set. > > Move the service.send() out of the creationComplete event and into the > initVars() function after you have set the ID variable. > > Also, change the url parameter of your HTTPService to: > > {'http://www.mydomain.com/script.php?ID=' + ID} > > Otherwise your PHP script will never see it. > > A few other things... > > Change your event types as follows: > > private function serviceResult(event:ResultEvent) > private function serviceFault(event:FaultEvent) > > Change your serviceResult function to: > > contentText.htmlText = event.result as String; > > > HTH > > > Steve > > > --- In [email protected], "uclamerrick" <merrick@> wrote: > > > > In my code below, I am trying to use the variable id pulled from > > flashvars and use it in the URL of the HTTPService. creationComplete > > calls the initVars() function which sets the variable ID equal to the > > parameter id from flashvars. > > > > My variable ID is not accessible within HTTPService, but within > > serviceResult() it is getting the value of ID and printing to the > > Canvas TextArea with id="contentText". > > > > I unsuccessfully tried using mxresult as well within the HTTPService. > > > > Any thoughts on what I can do to solve this? > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > creationComplete="service.send();initVars();" > > layout="absolute" > > backgroundGradientColors="[0xffffff,0xffffff]" > > width="100%" height="300" > > > > > > > > > <mx:Script> > > <![CDATA[ > > import mx.rpc.events.FaultEvent; > > import mx.rpc.events.ResultEvent; > > > > [Bindable] > > public var ID:String; > > > > private function initVars():void { > > ID = Application.application.parameters.id; > > } > > > > private function serviceResult(event:Event):void { > > > > contentText.htmlText = ID + > > service.lastResult.content; > > } > > > > private function serviceFault(event:Event):void { > > trace('broken service'); > > } > > ]]> > > > > </mx:Script> > > > > <mx:HTTPService url="{'http://www.mydomain.com/script.php' + ID}" > > id="service" result="serviceResult(event)" fault="serviceFault(event)" > > method="GET" contentType="application/xml" useProxy="false"> > > </mx:HTTPService> > > <mx:Canvas...> > > <mx:TextArea ... id="contentText"/> > > </mx:Canvas> > > </mx:Application> > > >

