Highlighted

Buttons for Beginners

New Here ,
Mar 12, 2019

Copy link to clipboard

Copied

I am supposed to be creating an interactive presentation for a competition while displaying the use of buttons, and the fact that I am writing this is really embarrassing. In my presentation are buttons that navigate the scenes in order. One symbol for the next button. I placed one in the first and second scenes, so when they are clicked on the scene goes to the next. The button works for the first scene to the second, but the second button refuses to go to the third after.

There are other buttons on the second scene, 4 that play sound clips and 1 that shows a message while the mouse is down. But the 2nd "Next" button will not work, even though it is the exact same as the first in the previous scene! Any help is greatly appreciated, the competition is this weekend and I and my animations teacher are sprawling.

Try to place the code

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_9);

function fl_ClickToGoToNextScene_9(event: MouseEvent): void {

    MovieClip(this.root).nextScene();

}

only once in the first scene, first frame. And place the button button_4 in every scene, apart from the last because there isn't a next scene to go to.

The button (must be instance named in each scene button_4 (maybe think of a more descriptive name)) and the code are always valid no matter what scene. And nextScene() is a method with a variable value, depending what the next scene is in any given situation.

Don't place this more that once.

Klaus

TOPICS
Discussions

Views

76

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Buttons for Beginners

New Here ,
Mar 12, 2019

Copy link to clipboard

Copied

I am supposed to be creating an interactive presentation for a competition while displaying the use of buttons, and the fact that I am writing this is really embarrassing. In my presentation are buttons that navigate the scenes in order. One symbol for the next button. I placed one in the first and second scenes, so when they are clicked on the scene goes to the next. The button works for the first scene to the second, but the second button refuses to go to the third after.

There are other buttons on the second scene, 4 that play sound clips and 1 that shows a message while the mouse is down. But the 2nd "Next" button will not work, even though it is the exact same as the first in the previous scene! Any help is greatly appreciated, the competition is this weekend and I and my animations teacher are sprawling.

Try to place the code

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_9);

function fl_ClickToGoToNextScene_9(event: MouseEvent): void {

    MovieClip(this.root).nextScene();

}

only once in the first scene, first frame. And place the button button_4 in every scene, apart from the last because there isn't a next scene to go to.

The button (must be instance named in each scene button_4 (maybe think of a more descriptive name)) and the code are always valid no matter what scene. And nextScene() is a method with a variable value, depending what the next scene is in any given situation.

Don't place this more that once.

Klaus

TOPICS
Discussions

Views

77

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 12, 2019 0
Advocate ,
Mar 12, 2019

Copy link to clipboard

Copied

Hi Cory

So you are working with scenes, can you first confirm that you working in Actionscript 3?

And please past the code from scene 1 (where it works) and scene 2 (where it doesn't).

Klaus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2019 0
New Here ,
Mar 12, 2019

Copy link to clipboard

Copied

Thank you Klaus for respponding. I am indeed using Actionscript 3.

The button objects are the same. This is the one that works in the first scene (please excuse the comments)

/* Stop at This Frame

The Animate timeline will stop/pause at the frame where you insert this code.

Can also be used to stop/pause the timeline of movieclips.

*/

stop();

/* Click to Go to Next Scene and Play

Clicking on the specified symbol instance moves the playhead to the next scene in the timeline and continues playback in that scene.

*/

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_9);

function fl_ClickToGoToNextScene_9(event:MouseEvent):void

{

MovieClip(this.root).nextScene();

}

And this is the second scene button that doesn't work. I toggled a bit with the 9 before "(event:MouseEvent)". As it is 10 it would freeze on the second scene. Since I am doing a presentation I placed stops at the end of each scene until I am ready to move on.

/* Stop at This Frame

The Animate timeline will stop/pause at the frame where you insert this code.

Can also be used to stop/pause the timeline of movieclips.

*/

stop();

/* Click to Go to Next Scene and Play

Clicking on the specified symbol instance moves the playhead to the next scene in the timeline and continues playback in that scene.

*/

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_9);

function fl_ClickToGoToNextScene_9(event:MouseEvent):void

{

MovieClip(this.root).nextScene();

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2019 0
Advocate ,
Mar 12, 2019

Copy link to clipboard

Copied

Try to place the code

button_4.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene_9);

function fl_ClickToGoToNextScene_9(event: MouseEvent): void {

    MovieClip(this.root).nextScene();

}

only once in the first scene, first frame. And place the button button_4 in every scene, apart from the last because there isn't a next scene to go to.

The button (must be instance named in each scene button_4 (maybe think of a more descriptive name)) and the code are always valid no matter what scene. And nextScene() is a method with a variable value, depending what the next scene is in any given situation.

Don't place this more that once.

Klaus

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2019 0
New Here ,
Mar 12, 2019

Copy link to clipboard

Copied

It worked! Thank you very much for your help Mr. Klaus, from me and my programming teacher!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2019 0
kdmemory LATEST
Advocate ,
Mar 12, 2019

Copy link to clipboard

Copied

My pleasure.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 12, 2019 0