Skip to main content
nyds0806
Known Participant
June 24, 2014
Question

What is the code to insert in the Actions window, to make clicking a button go to a scene and frame in Flash CC?

  • June 24, 2014
  • 1 reply
  • 543 views

What is the code to insert in the Actions window, to make clicking a button go to a scene and frame in Flash CC?

Also, how can I do this w/o clicking any button?

This is the current code snippet that is failing:

stop();
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_8);
function fl_ClickToGoToScene_8(event:MouseEvent):void{
  MovieClip(this.root).gotoAndPlay(1, "Scene 1");
}

m.gisser@nydesign.com

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
June 24, 2014

There is nothing wrong with the code you show as written.  Are you getting any error message?  IF the code is already in the main timeline you do not need to target the root at all, but as written it should not err anyways.  Try putting a trace in the function to see if it is being called...

button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_8);

function fl_ClickToGoToScene_8(event:MouseEvent):void{
     MovieClip(this.root).gotoAndPlay(1, "Scene 1");
     trace("function is called");
}


nyds0806
nyds0806Author
Known Participant
June 25, 2014

Ned,

This Action Script worked in Flash CS5.5 but not in the new Flash CC.

How can we flag developers to this inconsistency?

Ned Murphy
Legend
June 25, 2014

I don't see that issue when I recreate a scenario using the code you show.   I place the button in a movieclip in a second scene and assign the code to it.  When I run the file and the second scene comes into play and I click the button it returns to restart scene 1.  I used the new Flash CC 2014 to test it.   I do not see the inconsistency you say you see, though I do not have CS5.5 working to compare to.