Copy link to clipboard
Copied
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:
Copy link to clipboard
Copied
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");
}
Copy link to clipboard
Copied
Ned,
This Action Script worked in Flash CS5.5 but not in the new Flash CC.
How can we flag developers to this inconsistency?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Ned, Can you send me the code I would use to go to a scene/frame w/o using a button, just a timeline event. Thanks.
Copy link to clipboard
Copied
You already have it, just pull it out of the function...
MovieClip(this.root).gotoAndPlay(1, "Scene 1");
Copy link to clipboard
Copied
So all my script would have is this below?
stop();
MovieClip(this.root).gotoAndPlay(1, "Scene 1");
Thank you for your help.
Copy link to clipboard
Copied
The stop() wouldn't make much sense since the line after is defeating its purpose.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now