I am using a Tab Navigator component in which there are three canvas components. When i click one of the canvas (or tab), a Pie Chart is displayed.
Actually what happens is that on-click
1. the canvas sends an HTTPService whose url is set to a php file 2. That php file actually gets information from a database. Based on that information an xml file is created 3. Fusion Chart uses that xml file to display a pie ch开发者_高级运维artProblem:
The database is being updated after some time.Is there any way the Pie Chart may get updated after every 3 minutes to reflect the modifications in the database? or
Can i send the particular HTTPService again and again after every 3 minutes 'in background'? or
Is there any good way to update the information in a particular canvas (or tab) of Tab Navigator?
Thanks a million. :)
Update: Trying to setup a timer now in my application but i am getting following errors against 2nd and 3rd line:2nd line error:
Multiple markers: -1120 Access of undefined property Countsec -1120 Access of undefined property mTimer 3rd line error: Access of undefined property mTimerBut i have defined everything as shown below in the code:
var mTimer:Timer=new Timer(1000*60*3); //3 minutes
mTimer.addEventListener(TimerEvent.TIMER,Countsec);
mTimer.start();
private function Countsec(e:TimerEvent):void
{
charts.send(); //HTTPService's ID that needs to be sent
}
The following lines need to be in a function call and not just declared in script:
mTimer.addEventListener(TimerEvent.TIMER,Countsec);
mTimer.start();
You should probably call them in a function on the initialize or the creationComplete events.
There are basically two kinds of updating you could do: timer-based or event-based.
If you want to do timer-based, just set up a timer at your application startup to run the update periodically.
If you want to do event-based, you set up the appropriate UI event handler to update the content.
To access the Tab Navigator tab contents, you use
yourTabNavigator.getChildAt(index)
where index is the 0-based index of the tab you want to access. You can then add, remove, change its content objects.
Alternatively, if you hardcode your tabs, you could just give each content object an ID, and access them directly by ID.
<mx:TabNavigator id="tn" width="100%" height="100%">
<!-- Define each panel using a VBox container. -->
<mx:VBox label="Panel 1" id="box1">
<mx:Label text="TabNavigator container panel 1"/>
</mx:VBox>
<mx:VBox label="Panel 2" id="box2">
<mx:Label text="TabNavigator container panel 2"/>
</mx:VBox>
<mx:VBox label="Panel 3" id="box3">
<mx:Label text="TabNavigator container panel 3"/>
</mx:VBox>
</mx:TabNavigator>
You could then access them as "box1" etc.
Try changing your "Countsec" function to public instead of private.
Also, you can add an argument for repeat count, after the timer length (1000*60*3, 0). 0 is infinite, or set it to a specific count.
One last thing you can do is call the constant directly instead of TimerEvent.TIMER. Use "timer" instead. "mTimer.addEventListener("timer",Countsec);"
精彩评论