I think I understand, but would love to see an example if you have one. So far I'm really digging working with Flex.
------------------------------ ~Steve http://lanctr.com/ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Wednesday, April 23, 2008 10:51 PM To: [email protected] Subject: RE: [flexcoders] Flex 3 / AIR: Creating a Timer and binding Text Also (gratuitous advice, not related to your problem) , you can use a single HTTPService instance and a single result handler for all calls. Send() returns an AsyncToken, which is a dynamic object that is associated with the specific send call, to which you can add any properties that you want. You can include functions if you want, but I usually just send a couple string parameters, on that indicates an id for the call, and an optional one that indicates special processing. In the result handler, you can access the AsyncToken using event.token, then access the values stored in you properties. I use a switch statement to determine what to do with any given result. So all results are in one place. It makes it easy to chain calls, and to maintain that chain. If you are interested, I can post some sample code. Tracy _____ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Andrew D. Goodfellow Sent: Wednesday, April 23, 2008 10:07 PM To: [email protected] Subject: Re: [flexcoders] Flex 3 / AIR: Creating a Timer and binding Text Hi Steve, You need a [Bindable] meta tag in front of every property you need to be bindable. You only have it on callID, not callStatus. -Andy On 4/23/08, Steve Good <[EMAIL PROTECTED] <mailto:sgood%40lanctr.com> > wrote: > (I sent this earlier, but it never made it through, so I apologize if it > ends up being a double post) > > > > I'm trying to make a call to a remote script at regular intervals. I can > get it to make the calls, but I can't figure out how to apply a timer to the > second call. I thought I had figured out how to bind the data to a text > object, but I'm not getting any results displayed. Here's a sample of the > code. > > > > <mx:HTTPService id="startCall" url="http://domain.com/dir/script1.cfm" > result="getCallID(event)"/> > > <mx:HTTPService id="getCallStatus" > url="http://domain.com/dir/script2.cfm" result="showStatus(event)"/> > > > > <mx:Script> > > <![CDATA[ > > import mx.core.Application; > > import mx.controls.Alert; > > import mx.events.CloseEvent; > > import mx.collections.ArrayCollection; > > import mx.rpc.events.ResultEvent; > > import flash.utils.Timer; > > import flash.events.TimerEvent; > > > > [Bindable] > > private var callID:Number; > > private var callStatus:String; > > > > private function placeCall():void{ > > startCall.cancel(); > > var params:Object = new Object(); > > params.foo = "bar"; > > startCall.send(params); > > } > > private function getCallID(event:ResultEvent):void{ > > callID = event.result as Number; > > } > > private function getStatus():void{ > > getCallStatus.cancel(); > > var params:Object = new Object(); > > params.callID = callID; > > getCallStatus.send(params); > > } > > private function showStatus(event:ResultEvent):void{ > > callStatus = event.result as String; > > } > > private function setupTimer():void{ > > var myTimer:Timer = new Timer(1000, 0); > > myTimer.addEventListener("timer",timerHandler); > > myTimer.start(); > > } > > private function timerHandler(event:TimerEvent):void{ > > getStatus(); > > } > > ]]> > > </mx:Script> > > > > <mx:Button x="78" y="150" label="Place Call" click="placeCall()"/> > > <mx:HBox x="10" y="196" width="93%"> > > <mx:Label text="Call Status:"/> > > <mx:Text text="{callStatus}"/> > > </mx:HBox> > > > > Also, the mx:text is giving this warning: "Data binding will not be able to > detect assignments to "callStatus"." > > > > Any help is greatly appreciated. > > > > Thanks! > > > > ~Steve > > http://lanctr.com/ > > > > > > > > ~Steve > > http://lanctr.com/ > > > >

