Copy link to clipboard
Copied
Is it possible to make a button go to 1 of 3 scenes? I'm making a animation and I need it to when you click the button it go to 1 of the 3 scenes for that button but it chooses 1 of those 3 scenes randomly. I'm new to actionscript, I do not know what I'm doing.
label the first frame of each scene (eg, "frame1_scene1", "frame1_scene2" etc);
then you can use:
btn.onRelease=function(){
_root.gotoAndPlay("frame1_scene"+Math.ceil(3*Math.random()));
}
Copy link to clipboard
Copied
label the first frame of each scene (eg, "frame1_scene1", "frame1_scene2" etc);
then you can use:
btn.onRelease=function(){
_root.gotoAndPlay("frame1_scene"+Math.ceil(3*Math.random()));
}
Copy link to clipboard
Copied
Do I need to put anything into the parenthese?
Copy link to clipboard
Copied
I got a handler erroer on btn.onRelease+function(){
Copy link to clipboard
Copied
There is no "+" sign like you show. It is an "="
Copy link to clipboard
Copied
just copy and paste that code. assign your button an instance name of btn and assign those frame labels.
Copy link to clipboard
Copied
Thank you so much!
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
You can, but if you have the option of not using scenes you should do it. Scenes and navigation tend to not mix well.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now