PDA

View Full Version : Tweens With The DataGrid



jmjinks
April 7th, 2009, 04:51 PM
I've been searching all over for an answer to this, but have not had much luck.

I have an .xml file that loads its data into a DataGrid. However, I don't want all the data to load up at once. I would like it to load the first five records, and after x amount of seconds fade out and fade in with the next five records.

Any suggestions, advice or help would be appreciated.

jmjinks
April 8th, 2009, 08:13 PM
Any suggestions?

Can anyone at least lead me in the right direction?

theCodeBot
April 8th, 2009, 09:03 PM
Since this is a rather broad question, it would be wrong to just throw you code that you would have to keep messing around with until it worked right, as that would make it a hacked together mess in the end.

What I can do is tell you what to research:

First thing you would have to do is load the data, which you have done.
Next thing you would need to do is set up a timer that performs what you need to do every 5 seconds (Timer (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Timer.html) class).
So make a timer that, every 5 seconds, calls the function that interacts with the next 5 objects. In order to interact with the 'next 5', you need to know what the 'last 5' were, we'll call it x. So store a variable that tells you where the 'next 5' start in the DataGrid. Each time the function is called, access the x'th through x+5'th elements in the datagrid, then set x += 5.

Of course, depending on your needs, you might instead have the function delete the items from the grid as it goes, or move them to the bottom as it accesses them, or similar. These are all relatively easy to do, but both of those particular scenarios would mean that you wouldn't need to keep track of where to start anymore, as it would always be index 0.