PDA

View Full Version : assigning many actions to many movie clips at the click of a button


milohound
01-11-2002, 01:30 AM
I have a simple but annoying problem.. I have 8 buttons each buttons plays a mc. each mc has a begining and an end (end is a fade out), so when a button is pressed it loads the corresponding mc, the mc plays until it reach a stop action in the middle of the timeline. What i need to do is: When another button is pressed it first plays the fade section of the current mc on screen, then plays the mc associated with the button just pressed, and so on throught the 8 buttons. Obviously each button can be pressed randomly. It will work with 2 buttons but on the third it has no effect. heres an example:
on (release) {
with (_root.servicewin2.print) {//print is the mc for the button
gotoAndPlay (2);
if (playing==0) {
gotoAndPlay (2);
} else if (playing==1) {
gotoAndStop (8);
}
with (_root.servicewin2.presentation) {//presentation is another mc which could be playing
if (playing==1) {
gotoAndPlay (11);
with (_root.servicewin2webdesigntxt) {//webdesign.txt is another mc which could be playing
if (playing==1) {
gotoAndPlay (8);//presentation will go and play the required frame but webdesign.txt won`t or vice verca.
}
}
}
}
}
}
any help will be much appreciated there must be a simpler way than this!!!

Billy T
01-11-2002, 02:23 AM
instead of making the playing variable true or false, try making it a value between 1 and 8. Then when clip 4 plays it gets to its stop action and sets playing to 4. The other buttons can then look at the playing var and act accordingly (like good little buttons should)

does that make sense?

milohound
01-11-2002, 01:11 PM
not sure what you mean? a little more help please!

Ricod
01-11-2002, 03:49 PM
This is what Billy meant :
Instead of looking wether or not its playing, use a variable that states WHAT's playing. If u have 8 mc's U can use 8 value's to check which one is playing and 0 if nothing's playing. So, yer mc's could have somthing like (for instance mc4): _root.Playing = 4;

The other button could then have code like :

on(release){
if (_root.Playing != 0){
_root.mc[_root.Playing].gotoAndPlay("fadeOut");
}
_root.mc[_root.Playing+1].gotoAndPlay("startMc");
}

adamll1
01-25-2002, 01:58 AM
Hi; would you mind breaking this down more for me? I would like to do the same thing but I don't understand it... For instance, what (and where) is the code on the MCs? I have four MCs, one of which is an intro that plays automatically, and three other MCs that are each triggered by a button. What code goes on the buttons? Thanks in advance for your time,

Adam

Ricod
01-28-2002, 09:37 AM
U see that snippet of code ? That goes on the button(s);