Reputation: 941
I need to be able to animate a LineChart based on the SeriesInterpolate data effect (I will have an Array of dataproiders). I want to have a "Play" button that will:
Any thoughts?
Upvotes: 0
Views: 665
Reputation: 2881
No problem, you're just going to use the effectEnd event
So on your effect, you'll want to attach the effectEnd listener, something like this :
<mx:SeriesInterpolate id="interpolateIn" duration="1000" effectEnd="fetchNextDataset()"/>
Then in your code, you need to store your datasets, and an index of which you're currently viewing, and finally the method that switches them.
private var datasets :ArrayCollection; // fill with your datasets
private var currentDataset : uint = 0; // holds current dataset
private function fetchNextDataset () : void {
if( currentDataset >= datasets.length) return; // out of range, played em all!
candlestickchart.dataProvider = datasets.getItemAt(currentDataset);
currentDataset++;
}
As far as the play button, all it needs to do is make the first call to fetchNextDataset();
<mx:Button label="play" click="fetchNextDataset()"/>
Make sense?
Upvotes: 2