I have a question. I think the answer is pretty simple.
On the flash site im working on, i have made a menu of 5 buttons.
They are all placed on the scene.
Every time the user presses a button i want an animation to be played (Frame 50 to 100), and THEN the script "gotoandplay “Label1”.
How do i do this without copying frame 50 to 100, and pasting them 5 times?
if you are using as2 you would do something like so.
this will set the button up to play the animation when it is released.
btn1_btn.onRelease = function(){
this.mcName.play();
}
then what you need to do is set you animation at frame 100 to tell the other mc to go to lable1
if you are using as3 itll look something liek this
//this sets up an eventListener for you button and then will execute the function playAnimation when the condition is met, in this case a mouse click event.
btn1_btn.addeventListener(MouseEvent.CLICK, playAnimation);
function playAnimation(event:MouseEvent):void
{
this.mcName.play();
}
Just rember to tell flash where you want to go at the end of you animation. Make a new keyframe on frame 100 and just put mcPath.gotoAndPlay(lable1);
that sould do it, hope it helps
[quote=koolkrasher;2353110]if you are using as2 you would do something like so.
this will set the button up to play the animation when it is released.
btn1_btn.onRelease = function(){
this.mcName.play();
}
then what you need to do is set you animation at frame 100 to tell the other mc to go to lable1
if you are using as3 itll look something liek this
//this sets up an eventListener for you button and then will execute the function playAnimation when the condition is met, in this case a mouse click event.
btn1_btn.addeventListener(MouseEvent.CLICK, playAnimation);
function playAnimation(event:MouseEvent):void
{
this.mcName.play();
}
Just rember to tell flash where you want to go at the end of you animation. Make a new keyframe on frame 100 and just put mcPath.gotoAndPlay(lable1);
that sould do it, hope it helps[/quote]
Thanks for the Quick answer, but i dont understand it all.
I dont want the Button to animate after its been pushed.
I want the content of the page to change.
Example:
Button 1 is pressed.
the text and images on the page animates and fades away, and some new content appears.
The way i wanted to do this was to have an “Content Outtro” animation at frame 50 to 100, and then an actionscript on frame 100 (gotoandplay “Label1”). But without making 5 copies of the frames 50 to 100, with gotoandplay “Label1”, gotoandplay “Label2” etc. scripts on the end of each animation
P.S im using AS2.0
AS 2 
Im looking for some kind of code like this:
If button1 is pressed
goto and play frames 50-100
then goto and play Label 1
If button2 is pressed
goto and play frames 50-100
then goto and play Label 2
etc.
do u have a moc file u are using? itll be better to explain if i can see what you have done already
[quote=helious;2353157]AS 2 
Im looking for some kind of code like this:
If button1 is pressed
goto and play frames 50-100
then goto and play Label 1
If button2 is pressed
goto and play frames 50-100
then goto and play Label 2
etc.[/quote]
I’d imagine a solution to this could be like this:
Button 1:
gotoAndPlay(50);
btn_pressed = 1;
Button 2:
gotoAndPlay(50);
btn_pressed = 2;
Button 3:
gotoAndPlay(50):
btn_pressed = 3;
etc with the number of buttons you want.
Frame 100:
if(btn_pressed == 1){
gotoAndPlay(label1);
}else if(btn_pressed == 2){
gotoAndPlay(label2);
}
Hope you get the idea, of course, this is a rather bad solution, just imagine if you have 100 buttons, but it should do the trick.
[quote=gigaboost;2353223]I’d imagine a solution to this could be like this:
Button 1:
gotoAndPlay(50);
btn_pressed = 1;
Button 2:
gotoAndPlay(50);
btn_pressed = 2;
Button 3:
gotoAndPlay(50):
btn_pressed = 3;
etc with the number of buttons you want.
Frame 100:
if(btn_pressed == 1){
gotoAndPlay(label1);
}else if(btn_pressed == 2){
gotoAndPlay(label2);
}
Hope you get the idea, of course, this is a rather bad solution, just imagine if you have 100 buttons, but it should do the trick.[/quote]
Great! EXCATLY what i was looking for.
Ill report back when i tried it out!
Should i not have a “OnRelease” on the buttons before the gotoandplay?
depends if u are scripting on the button or on the timeline.
if you on the button itll look like so
onRelease(){
gotoAndPlay(50):
btn_pressed = 3;
}
if your on the timeline then its
this.buttonInstanceName.onRelease = function()
{
gotoAndPlay(50):
btn_pressed = 3;
}
[quote=helious;2353228]Great! EXCATLY what i was looking for.
Ill report back when i tried it out!
Should i not have a “OnRelease” on the buttons before the gotoandplay?[/quote]
Yeah, what koolkrasher said, just didn’t add it because it felt redundant. You SHOULD be able to add a variable to somethings name somehow, I just don’t know how, but it would make it easier if you have loads of buttons.