views:

33

answers:

2

Hi all,

I am developing a component that can list files that users select from their filesystem. I'm using a (extended) FileReferenceList and (my own) FileReferenceDisplayList. The latter listens for events from the former.
If the FileReferenceDisplayList receives a FileReferenceListEvent.ADDED event, it should display the new item in the displaylist. However, when multiple files are added at once I want to animate them sequentially in stead of at the same time. What would be the best strategy for making sure the items are animated with small pauses between them?

I thought about putting newly added items in a queue and then polling the queue for existing items with an Event.ENTER_FRAME. But maybe you can suggest another method that doesn't need to make use of Event.ENTER_FRAME?

Edit
I guess I forgot to mention that the part that puzzles me the most how I can set some timeout if multiple files are added. Maybe I should use the queue's length to multiply the timeouts for the items? So, if a file is added, I set the animation timeout for that item to be multiplied by the current length of the queue? (Just thinking out loud here).

Thanks in advance.

+1  A: 

take a look at TimeLineLite from Greensock - http://blog.greensock.com/timelinelite/

insertMultiple() and appendMultiple() provide some very powerful sequencing tools, allowing you to add an Array of tweens or timelines and optionally align them with SEQUENCE or START modes, and even stagger them if you want.

Josh
A: 

You can use a Timer but why not stick with the ENTER_FRAME.

Patrick