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

Buttons only work once or twice

Guest
Mar 02, 2014 Mar 02, 2014

Hi guys, i'm still new to flash and i really need some help. Here's the story :

so i'm making a simple digital comic right now, that shows one or two panels/pictures/drawings at a time with only 3 buttons to navigate (a next button, an exit button and a page selection button). here are some info :

-  I use CS6

-  I use simple tweenings for each picture (fade in/out, motions, etc)

-  I will publish it in 2 formats, .exe and .apk for android

-  I have 7 scenes, 1-6 for the main comic, and scene 7 for the page selection menu (inside a movie clip)

-  I only use 2 movie clips, one for the intro animation and another one for the page selection menu that i mentioned above

-  because i'm still a noob, i always use code snippets (sorry)

-  I mainly only use these codes snippets : Stop at this frame, Click to go to frame and play, Click to go to scene and play.

-  for the exit button, i use this code :

button_e.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void

{

           fscommand("quit");

- for the next button, i use this code :

button_1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_3);

function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void

{

          gotoAndPlay(frame number);

}

for the page selection button, i use this code :

b_page.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_40);

function fl_ClickToGoToScene_40(event:MouseEvent):void

{

          MovieClip(this.root).gotoAndPlay(1, "Scene 7");

}

Now here's the problem :

The page selection button worked fine in the beginning. Then i click the next button several times (lets say, from page 1, scene 1 i clicked the next button several times until i arrived on page 6, scene 2). Then i click the page selection button which opened the movie clip. Inside this movie clip is several another buttons, each one takes me to different pages. For example, i clicked a button that linked to page 7 (inside scene 2). By the way, the code goes like this :

b_7.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene_3);

function fl_ClickToGoToScene_3(event:MouseEvent):void

{

          MovieClip(this.root).gotoAndPlay(500, "Scene 2");

}

Still no problem detected. Then i proceed to click the next button again to read the rest of the comic. At this point, the page selection button  (and the exit button) stopped working. Clicked it so many times and nothing happened. So just like what i wrote in the title, it only works once or twice.

Any suggestions?  (I wanted to upload the .fla so you guys can take a look at it but the size is way too big )

Screenshot :

http://s25.postimg.org/azarwqvzj/screenie.jpg

Thank you!

TOPICS
ActionScript
2.0K
Translate
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 , Mar 03, 2014 Mar 03, 2014

put your first scene button on its own layer at the beginning of the scene and assign its name.  extend its timeline to the end of the scene.  test.  any problems?

if not, add additional keyframes to the button's layer as needed for your project being careful to NOT remove the button from any keyframe.  test.  any problems?

if not, do likewise for the other buttons in the other scenes.

if you want your button to NOT appear in some frames do NOT remove it from that keyframe.  assign its visible prop

...
Translate
Community Expert ,
Mar 02, 2014 Mar 02, 2014

most likely your whatever button is failing does not exist at some point during your frame changes and flash loses its reference.

to remedy, rename the button that fails, at the point on your timeline where it fails and use that name in your code.

Translate
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
Guest
Mar 02, 2014 Mar 02, 2014

Hi Kglad, thanks for the response,

I tried what you suggested but the problem is still there. And i just realized that the button can stop working  even before the scene changed. in other words, as long as i've clicked the whatever button once, the next time i click it again, there's a big chance that it'll stop working, so the point where it fails is kinda random. Oh, and for that button, i only use one keyframe for each scene, at the beginning of each timeline. Oh man, i should've started learning to use flash earlier..

Translate
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
Guest
Mar 02, 2014 Mar 02, 2014

UPDATE

I just found out that the fails wasn't random after all. The button only works in the beginning of each scene (from the point the first animation/tweening starts till it ends. after that point, the button will become useless again). So out of all 26 comic pages that i divided into 6 scenes, the button will only work 6  times. I have no idea why

Translate
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 ,
Mar 03, 2014 Mar 03, 2014

put your first scene button on its own layer at the beginning of the scene and assign its name.  extend its timeline to the end of the scene.  test.  any problems?

if not, add additional keyframes to the button's layer as needed for your project being careful to NOT remove the button from any keyframe.  test.  any problems?

if not, do likewise for the other buttons in the other scenes.

if you want your button to NOT appear in some frames do NOT remove it from that keyframe.  assign its visible property to false or use removeChild.

Translate
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
Guest
Mar 03, 2014 Mar 03, 2014

Hi Kglad,

After adding additional keyframes to the layers, everything works perfectly! Thank you so much! You're awesome

Translate
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 ,
Mar 03, 2014 Mar 03, 2014
LATEST

you're welcome.

Translate
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