5 Replies Latest reply on May 15, 2007 10:45 AM by compubrook

    Timing a HTTPService

    compubrook
      Hi,

      I had an earlier post where I am displaying multiple charts on an Accordian. I have it set up to make an HTTP Service call on the "change" event, and now I'd like to have it make a service call so that it automatically updates the data every minute or so.

      My current code is below (it contains other poeple's code for this forum too):

      <mx:Script>
      <![CDATA[

      import mx.events.*;
      import mx.rpc.events.*;



      [Bindable] public var chartdata:ArrayCollection;
      [Bindable] private var newchartdata:ArrayCollection;

      private function getMoreData():void
      {
      pSrv.send();
      }


      [Bindable]
      public var onedaytime:Array = ["12 am","","","","","","","","","9 am", "","","12 pm","","2 pm","","","5 pm","","","","9 pm","","",""];



      import flash.utils.Timer;
      import flash.events.TimerEvent;

      public function ShortTimer() :void
      {

      var minuteTimer:Timer = new Timer(10000);

      // designates listeners for the interval and completion event
      minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

      // starts the timer ticking
      minuteTimer.start();
      }
      public function onTimerComplete(evt:TimerEvent):void
      {
      pSrv.send();
      pSrv2.send();
      }
      ]]>
      </mx:Script>

      And in the accordian I have:
      <mx:Accordion x="0" y="0" creationComplete="pSrv.send();" width="100%" height="100%"
      change="getMoreData()" headerHeight="50" themeColor="#80ffff" fontSize="17" color="#000000" cornerRadius="0">

      And in the LineChart I have:
      <mx:Canvas label="Office Temperature Data" fontSize="4" width="100%" height="100%" cornerRadius="0">

      <mx:Panel x="0" y="0" width="100%" height="100%" layout="absolute" borderStyle="none">
      <mx:LineChart id="T_OFFICE" creationComplete="ShortTimer()" width="100%" height="100%" dataProvider="{pSrv.lastResult.data.point}" showDataTips="true" fontFamily="Verdana" fontSize="12" >


      To me, this should work - is there something I'm not getting here? I want to chart to continuously tick along as it gets more data.

      Thanks to all who can help!