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

Button only works once! I NEED HELP~

Community Beginner ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

Hi, I'm working on my project and it is basically a animated storybook. I have like 20+ scenes and in each of the scene there is a next and previous button to jump from scene to scene, but now I am facing a problem on my next and previous button which is when I perform test on FLV the button only works once. For example: I'm now in Scene 1 and I clicked on the next button to jump to the scene two, and when I clicked on the previous button to go back to Scene 1 the button is not working anymore. Can anyone please provide me a solution about my problem? I really appreciate that! >.<

This is my ActionScript Code for my button in every scenes:-

import flash.events.MouseEvent;

stop();

next_btn1.addEventListener(MouseEvent.CLICK, nextpage2);

function nextpage2(event:MouseEvent):void

{

          gotoAndStop(26);

}

PrvButton1.addEventListener(MouseEvent.CLICK, prvpage_main);

function prvpage_main(event:MouseEvent):void

{

          gotoAndStop(1);

}

TOPICS
ActionScript

Views

1.6K

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

Community Expert , Aug 13, 2013 Aug 13, 2013

your button must continue to exist on all frames.

to remedy, create a new layer that contains your next and previous buttons.  add the buttons to frame 1 and assign instance names.  do NOT add any other keyframes, yet.

test.

if everything works, you can add keyframes where needed, but do NOT remove either button from any keyframe.

Votes

Translate

Translate
Community Expert ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

your button must continue to exist on all frames.

to remedy, create a new layer that contains your next and previous buttons.  add the buttons to frame 1 and assign instance names.  do NOT add any other keyframes, yet.

test.

if everything works, you can add keyframes where needed, but do NOT remove either button from any keyframe.

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
Community Beginner ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

ScrnShot.jpg

Above is the content of my animation storybook, I have both the Button and ActionScript layer in every of the scenes.

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
Community Expert ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

no, you don't.  more than 1/2 the frames shown do NOT contain the objects in THAT Button layer.

in addition, you have a second button layer shown which is definitely going to cause the problem i just explained you needed to avoid.

again, delete all your Button layers.

create a new layer, and in frame 1 add your buttons.  extend that timeline to your last frame.  if you don't have another scene (the way flash defines scenes), you should be able to test and see no problem.

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
Community Beginner ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

Then how about the actionscript? Because I need to make sure the next and previous button is jumping towards the correct scene (which are the frames), so how am I going to write the script because my scene is not a movieclip it contains some animations and mouseEvents.

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
Community Expert ,
Aug 13, 2013 Aug 13, 2013

Copy link to clipboard

Copied

label those frames and use frame labels.

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
Community Beginner ,
Aug 14, 2013 Aug 14, 2013

Copy link to clipboard

Copied

Thanks for the reply kglad. I've deleted all the button layers in every scenes and created a button layer from frame 1 until the last frame, but I still got this output here that I don't really understand what it means.

Output.jpg

Timeline.jpg

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
Community Expert ,
Aug 14, 2013 Aug 14, 2013

Copy link to clipboard

Copied

you're trying to reference something that doesn't exist when your code executes.

for example, if you have code in MainP that tries to reference a button in Scene1, that will trigger the error you see.

to pinpoint your error(s), click file>publish settings>swf and tick "permit debugging".  retest.  the problematic line number(s) will be in the error message(s).

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
Community Beginner ,
Aug 14, 2013 Aug 14, 2013

Copy link to clipboard

Copied

Oh yes~! The problem solved like magic. Thank you so much kglad....

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
Community Expert ,
Aug 14, 2013 Aug 14, 2013

Copy link to clipboard

Copied

LATEST

you're welcome.

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