One play button to play multiple movie clips sequentially
Hi - I have two issues I'm trying to solve:
1. I have 4 movie clips on the stage that are played by themselves with their own play button. When selected each play button starts/stops/restarts the movie clip as intended. However, if another play button is selected I'd like the 1st movie clip to stop and the new movie clip to start playing immediately on one click. Right now everything is functioning properly except that it takes two clicks for the 1st movie clip to stop and the 2nd one to start playing. Any ideas?
2. I need to get the larger play button in top right corner to play all the movie clips in sequential order. I can't find anything on how to write that script so that button currently doesn't work. I'm not sure where to start with the code, any help is appreciated.
TESTING multi play btns_8.fla - Google Drive
TESTING multi play btns_8.swf - Google Drive
Here's AS 3.0 on main timeline:
var playing:Boolean = false;
/*large button plays all movieclips in a row*/
/*1st movieclip*/
Count1.stop();
function startCount1(event:MouseEvent):void
{
if(Count1.currentFrame == Count1.totalFrames) {
playing = false;
}
if(playing){
Count1.gotoAndStop(1);
} else {
Count2.gotoAndStop(1);
Count3.gotoAndStop(1);
Count4.gotoAndStop(1);
Count1.gotoAndPlay(1);
}
playing = !playing;
}
startButton1.addEventListener(MouseEvent.CLICK, startCount1);
/*2nd movieclip*/
Count2.stop();
function startCount2(event:MouseEvent):void
{
if(Count2.currentFrame == Count2.totalFrames) {
playing = false;
}
if(playing){
Count2.gotoAndStop(1);
} else {
Count1.gotoAndStop(1);
Count3.gotoAndStop(1);
Count4.gotoAndStop(1);
Count2.gotoAndPlay(1);
}
playing = !playing;
}
startButton2.addEventListener(MouseEvent.CLICK, startCount2);
stop();
/*3nd movieclip*/
Count3.stop();
function startCount3(event:MouseEvent):void
{
if(Count3.currentFrame == Count3.totalFrames) {
playing = false;
}
if(playing){
Count3.gotoAndStop(1);
} else {
Count1.gotoAndStop(1);
Count2.gotoAndStop(1);
Count4.gotoAndStop(1);
Count3.gotoAndPlay(1);
}
playing = !playing;
}
startButton3.addEventListener(MouseEvent.CLICK, startCount3);
stop();
/*4th movieclip*/
Count4.stop();
function startCount4(event:MouseEvent):void
{
if(Count4.currentFrame == Count4.totalFrames) {
playing = false;
}
if(playing){
Count4.gotoAndStop(1);
} else {
Count1.gotoAndStop(1);
Count2.gotoAndStop(1);
Count3.gotoAndStop(1);
Count4.gotoAndPlay(1);
}
playing = !playing;
}
startButton4.addEventListener(MouseEvent.CLICK, startCount4);
stop();
