Re: [flexcoders] Automatically flip through 3 charts

2011-09-07 Thread Srinivas Sandur Madhu Murthy
Rishi did you understand what Wesley's question was?

Anyways, I guess wesley wants the view stack to show those charts one after the 
other every 5 seconds automatically! if this is correct then Wesley, you could 
change the viewstack's selectedIndex every 5 seconds once to other one. Below 
is a sample. [Assumption : ViewStack id is viewstack]

private var index:Number=0;
private var timer:Timer = null;
private var delay:Number = 5 seconds or whatever delay; //Remember this is in 
milliseconds

private function application_completeHandler(event:FlexEvent):void{ //This 
function should be in creation complete of your custom component or application
timer = new Timer(delay);
index = 0;
timer.addEventListener(TimerEvent.TIMER, onTimerHandler);
timer.start();
}

private function onTimerHandler(event:TimerEvent):void{
index++;
if(index  2){
index = 0;
}
changeStack();
}

private function changeStack():void{
viewstack.selectedIndex = index;
//viewstack.dispatchEvent(new 
IndexChangedEvent(IndexChangedEvent.CHANGE)); //Un-comment only if necessary :)
//You could always invalidate or fire IndexChangeEvent w.r.t viewstack 
to notify there was change in index - Not a compulsion
}

Hope this helps.

Off-course this is just one way, you could always refractor with better 
approach.

Srinivas

On Sep 6, 2011, at 10:48 PM, Rishi Tandon wrote:

 
 Use a timer and set the rotation angle in some global variable.
 Whenever user clicks on the viewstack, use apply the hlabal variable to the 
 corresponding chart.
 
 Sent from my iPhone
 
 On Sep 6, 2011, at 7:42 PM, chinwesley wesleyc...@hotmail.com wrote:
 
  
 Hi everyone,
 
 I am using Flex 4.5.
 
 I have 3 charts in a viewstack. I would like to rotate through each chart 
 after every 5 seconds. It must do this automatically. So I guess the 
 viewstack will have to update every 5 seconds. How can I do this?
 
 Any help is appreciated.
 
 
 



Re: [flexcoders] Automatically flip through 3 charts

2011-09-06 Thread Rishi Tandon
Use a timer and set the rotation angle in some global variable.
Whenever user clicks on the viewstack, use apply the hlabal variable to the 
corresponding chart.

Sent from my iPhone

On Sep 6, 2011, at 7:42 PM, chinwesley wesleyc...@hotmail.com wrote:

 Hi everyone,
 
 I am using Flex 4.5.
 
 I have 3 charts in a viewstack. I would like to rotate through each chart 
 after every 5 seconds. It must do this automatically. So I guess the 
 viewstack will have to update every 5 seconds. How can I do this?
 
 Any help is appreciated.