(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/

 

Reply via email to