PDA

View Full Version : Play mc2 once mc1 is finished playing?


Oxity
05-29-2008, 12:24 AM
I need help with how to get a a mouse event to play a movie clip and wait for it to finish playing and then go to and play a different movie clip.

This is some idea of the code I am looking for.

button.addEventListener(MouseEvent.CLICK, clickHandler_1);
function clickHandler_1(event:MouseEvent)
(
movieclip1.play(1);
\\ once movieclip1 reaches last frame then
movieclip2.play(1);
);

Also I am looking for some code to do this.

button.addEventListener(MouseEvent.CLICK, clickHandler_1);
function clickHandler_1(event:MouseEvent)
(
gotAndPlay("action");
\\ once timeline reaches say frame label "endAction" then play movieclip2
movieclip2.play(1);
);

Thanks in advance - Dave

Oxity
06-01-2008, 02:17 PM
Oh yeah, this is a AS3 question by the way.

Is there anywhere I should be taking a look at to find a answer?

Thanks again.

RIT_FlashKid
06-02-2008, 02:48 AM
Oxity - you are going to need to use an event listener such as Event.COMPLETE to be able to run one musicclip after another. The way I would try writing it would be:


button.addEventListener(MouseEvent.CLICK, clickHandler_1);
function clickHandler_1 (event:MouseEvent):void {
movieclip1.play();
}
//the clickHandler_1 below this line might need to be movieclip1 but I'm not sure
clickHandler_1.addEventListener(Event.COMPLETE, playmusicclip2);
function playmusicclip2 (event:Event):void {
movieclip2.play();
}

Hope this helps
-BC

cemkocabasa
06-04-2008, 07:35 AM
how to do this in as2?