• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Buttons for Beginners

New Here ,
Mar 12, 2019 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.

Views

173

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
community guidelines

correct answers 1 Correct answer

Advocate , Mar 12, 2019 Mar 12, 2019

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 ne

...

Votes

Translate

Translate
Advocate ,
Mar 12, 2019 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

Votes

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
community guidelines
New Here ,
Mar 12, 2019 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();

}

Votes

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
community guidelines
Advocate ,
Mar 12, 2019 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

Votes

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
community guidelines
New Here ,
Mar 12, 2019 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!

Votes

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
community guidelines
Advocate ,
Mar 12, 2019 Mar 12, 2019

Copy link to clipboard

Copied

LATEST

My pleasure.

Votes

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
community guidelines