PDA

View Full Version : Multiple Actions on movies


barry_sheen
01-08-2002, 01:13 PM
Hi There,

I have attached a .fla file of what I have at the moment. I have no programming experience so please make your replies as simple as possible. I'm finding my problem difficult to describe, hope it makes sense.

Right, I have three buttons, each of them runs a different movie on release. The movie plays to a certain point and then it has a stop action. I would like to be able to then click a different button which would finish the first movie and then play the second. But I want to be able to click any button in any order.

Any ideas how this could be achieved?

Cheers

Barry

Ricod
01-08-2002, 02:20 PM
Kinda depends on what u exactly want. Anyway, I'm assuming here the movies are on the main timeline and labeled "mc1", "mc2" and "mc3". Every mc has a stop() on the 1st frame and a _root:nowPlaying = 1; (replace 1 by 2 in the 2nd mc etc.)

If u want the 4th button to immediately stop the playing movie and start playing the next :

on(release){
var playsNr = _root:nowPlaying;
if (playsNr==3){
var nextNr = 1;
}else{
var nextNr = playsNr++;
}
_root.mc[playsNr].gotoAndStop(1);
_root.mc[nextNr].gotoAndPlay(2);
}


If u want the first to finish playing and THEN start playing the next, u'll need to declare a variable like :
Playing=0; at the 1st frame and Playing=1; at the 2nd.
Then u'll need to add that info to your button code like :

on(release){
loopMC.gotoAndPlay(2);
}

In this case u'll need a 3-frame mc labeled "loopMC" with a stop(); on the 1st frame the below stated code on the 2nd and a gotoAndPlay(2); on the 3rd.

var playsNr = _root:nowPlaying;
if (playsNr==3){
var nextNr = 1;
}else{
var nextNr = playsNr++;
}
if(_root.mc[playsNr].Playing==0)
_root.mc[nextNr].gotoAndPlay(2);
gotoAndStop(1);
}


I suggest u check out our tutorials about variables, advanced paths and loops. They r MUST read material !