Search code examples
apache-flexactionscript-3cairngorm

Set time 5 seconds to dispatch cairngorm event in flex


I have a live chart. I need to refresh the chart with 5 seconds time interval.

For displaying the live chart i disptach the event (myEvent) extends cairngormevent.

And after 5 seconds , the same event has to dispatch again adn get the data to display thelie cart.

And how the event dispatch after 5 seconds with out any manula call..?

Please anyone knows, update me asap. It is very urg for me.

Thanks, ravi


Solution

  • It is working now. This is the way i dispatch the event with time interval.

             private var timer:Timer; 
    
                private function getChart():void
            {
        var chartEvent:ChartEvent=new ChartEvent();
    
                    chartEvent.dispatch();
    
            }
    
    
             private function setTimer():void {
                timer = new Timer(5000);
    
                timer.addEventListener(TimerEvent.TIMER, onTimer);
                timer.start();
                 CursorManager.showCursor();
    
             }
    
            private function onTimer(evt:TimerEvent):void {
                Alert.show("in");
    
                getChart();
    
                Alert.show("Dispatching Event:--->");
    
            }