Skip to main content
Known Participant
April 7, 2021
Question

(Help) Button clicking go to the next scene and play

  • April 7, 2021
  • 1 reply
  • 3143 views
  • Hello I am creating a short story for my Uni project and I have two characters which I inserted them as buttons. I want when someone clicks on them to go on seperate scenes. I have given different names to these scenes. So I am inserting the code for each character and when I test the movie, when I click on each character it just repeats the scene from the start.
  • Ps: on the end of all frames I have put stop so the one interacting with the movie has time to choose. Maybe it's because of it? 

 

  • Also I have tried inserting a specific Frame rate this doesn't work either. 

I am putting the code which I used for one of my buttons.

/* Click to Go to Scene and Play

Clicking on the specified symbol instance plays the movie from the specified scene and frame.

 

Instructions:

1. Replace "Scene 3" with the name of the scene you would like play.

2. Replace 1 with the frame number you would like the movie to play from in the specified scene.

*/

 

zaxra.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_2);

 

function fl_ClickToGoToScene_2(event:MouseEvent):void

{

  •  MovieClip(this.root).gotoAndPlay(1, "spitiz");

}

 

Thank you so much! 

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
April 7, 2021

1. is this an as3 project.  (that's as3 code and won't work if it's an html5/canvas project.)

2. you need some button or movieclip on stage (when that code executes) with instance name (in the properties panel) zaxra.

3. you need a scene named "spitiz".  if that's the current scene, it will replay.

4. any error messages when testing?

 

Sofia5FCDAuthor
Known Participant
April 7, 2021

Thank you I made it work with adding a esperate layer named stop and putting the code there! 

kglad
Community Expert
Community Expert
April 8, 2021

you're welcome