Skip to main content
March 8, 2013
Answered

Is it possible to make a button go to 1 of 3 scenes?

  • March 8, 2013
  • 2 replies
  • 832 views

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.

This topic has been closed for replies.
Correct answer kglad

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()));

}

2 replies

Ned Murphy
Legend
March 8, 2013

You can, but if you have the option of not using scenes you should do it.  Scenes and navigation tend to not mix well.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
March 8, 2013

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()));

}

March 8, 2013

Do I need to put anything into the parenthese?