How to Pause and Loop the Timeline in Flash CS3 (AS3)
How to pause the main timeline (or any timeline), and how to loop it, are fairly common questions on the Adobe forums — not super hot topics, but they continue to crop up every few months. I suggested an AS2 approach to both questions in “How to Pause a Timeline (AS2)” and “How to Loop a Movie Three Times (AS2)” in 2006, but now with Flash CS3’s support for ActionScript 3.0, a couple of updates make good sense.
Check out “Using ActionScript to pause and loop the timeline in Flash,” in the Adobe Design Center, to see how things have changed. Looping, as it turns out, can be handled in practically the same way. The recommended approach for pausing now calls for the Timer class, which operates very differently from the setInterval() used in AS2.
July 21st, 2009 at 2:55 am
Morning David
Development on the training app continues steadily. Now for a query concerning implementing delays in AS3. There is copious information about the TIMER and pauing the timeline. This is not what I’m looking for. I’m trying to build an animation of a directional “radio wave” being propagated from a point. The “wave” must comprise of an attenuating arc that starts off with a fixed centre point on the left but an increasing radius and arc length to the right. The arc must be displayed on the screen (addChild), a slight delay and then removed (removeChild). There must obviously also be a delay between each successive “wave” as it attenuates out across the screen. I can get circles to do this - concentric circles expanding out from fixed point but am having problems with doing the same with an arc. All my attempts of adding a delay in the code and then remving the displayed circle ‘falls through’ so you never actually see anything displayed. How can one just suspend or delay execution within ActionScript 3 itself in the coding?
e.g.
Set Up Arc’s Parameters
Display Arc
Wait For 10ms
Remove Displayed Arc
Wait For 400ms
Bump Arc’s Parameters (+radius +arclength)
Thanks as always
Regards
Mike