PDA

View Full Version : Play Animation Then Open Selected Item



tomyknoker
03-01-2007, 03:26 PM
Hi all... Am wondering the best way to do this... I have 4 menu items, each time one of them is pressed an animation plays BEFORE it goes to the selected frame label. But I only want to have one animation on the timeline... IS there a way to do it so Flash knows what button is pressed and after the animation plays the correct frame label? Otherwise I guess I could have 4 of the same animation before each frame label just seems wrong to do it that way... I'm sure I can do it with As somehow...

BLiZZaRD
03-01-2007, 08:04 PM
To do that (if I understand clearly enough) you will tell the on(release) AS how to handle the event. Usually with an if/else statement. It is possible you will need to use currentframe as well, or at least a mixture of the methods. If I can get my brain to function I will post the code here:



on(release){
_root.BtnWhole.gotoAndStop("44");
if (_root.BtnWhole._currentframe == 44){
_root.BtnStormCreative.gotoAndPlay("56");
}
}


You should be able to see the idea here. first you tell which MC/Button/timeline the frame to go to, then we check, if it is there then take the other MC/Button/timeline to the frame you want it to go.

You can add other things too...



on(release){
_root.BtnWhole.gotoAndStop("44");
if (_root.BtnWhole._currentframe == 44 && _root.BtnWhole.BtnContactUs._currentframe == 12){
_root.BtnStormCreative.gotoAndPlay("56");
}
}


Or add other if's to make other things do other things as well...



on(release){
_root.BtnWhole.gotoAndStop("44");
if (_root.BtnWhole._currentframe == 44){
_root.BtnStormCreative.gotoAndPlay("56");
}
else if (_root.BtnContactUs._currentframe == 12){
_root.BtnContactUs._visble = false;
}
}



You see the idea.