views:

19

answers:

1

i started learning ActionScript3 and now i´ve got a problem: I want to start moviclips one by one on the same stage. For example: mc_A plays and in the end it starts the mc_B to play. than mc_B plays and starts in the end the mc_C .... other idea: the moviclips start at different times with a timer? I hoppe somebody can help me, cause I didn´t find the right code! Thanks a lot

A: 

The simplest way to do this would be to have code on the last frame of the timeline for mc_A call something like:

parent["mc_B"].play();

This really isn't the best way to go about it as it means that mc_A and mc_B have to always have the same names and share the same parent - but it will work and may be the easiest way for you to achieve the effect given limited experience.

Better would be to have mc_A dispatch an event which mc_B is listening for. mc_A's last frame could call something like:

dispatchEvent(new Event(Event.COMPLETE));

and your document class could have a line that says something similar to:

mc_A.addEventListener(Event.COMPLETE, function(){
    mc_B.play();
});

If you stored these movieclips in an array you'd be able to move a pointer along the array and play the next one in sequence each time an event was dispatched.

It depends on what you're trying to do and how likely you are to shift things around. The event driven approach is "better" but may be harder to wrap your head around if you're new to programming in general.

Austin Fitzpatrick