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

Forward and back button functions overlap?

New Here ,
Sep 25, 2014 Sep 25, 2014

I'm sorry if this is a really dumb question but It doesn't seem to be an error, but more it's just how flash works so I have no idea how to fix it.

Dropbox - Argh I don't understand.swf

Dropbox - Argh I don't understand.fla

I've got this at the start

function Play1(event:MouseEvent):void

{

  gotoAndPlay("Scene_1");

}

function Play2(event:MouseEvent):void

{

  gotoAndPlay("Scene_2");

}

function Play3(event:MouseEvent):void

{

  gotoAndPlay("Scene_3");

}

And this on my frames

Back_button.addEventListener(MouseEvent.CLICK, Play3);

Next_button.addEventListener(MouseEvent.CLICK, Play2);

If you don't want to download my example, the problem is that after a frame is revisited, the forward and back buttons no longer function properly so I'm guessing the script is overlapping or something?

I also have another problem. If I try to make something invisible, it will default back to being visible when I click to go to the next scene.

Cube_hide.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void

{

  Cube.visible = false;

  Cube_hide.visible = false;

  Cube_Show.visible = true;

}

Cube_Show.addEventListener(MouseEvent.CLICK, fl_ClickToShow);

function fl_ClickToShow(event:MouseEvent):void

{

  Cube.visible = true;

  Cube_hide.visible = true;

  Cube_Show.visible = false;

}

Cube_Show.visible = false;

The show and hide buttons sit on top of each other which is why they make each other visible.

So yeah if you can help me in any way, even if it's just what to look up, I'd appreciate it greatly.

TOPICS
ActionScript
202
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
LEGEND ,
Sep 25, 2014 Sep 25, 2014
LATEST

As far as the buttons go, my guess is that you do not reassign the listeners to them if you leave and return or however you have things worked otu timeline-wise.  If you put a trace() call in the event handler functions you should be able to see whether or not the functions are being called... if they are not then you can conclude the buttons lose their listeners.

As far as things being visible or not goes, it might be a matter of working with scenes where something in one scene is not necessarily that same object oin the next scene.

Your best bet to get away from all of these issues will be to get away from using scenes at all.  They have never been very useful for navigation purposes, moreso for pure animations where you simply want to divide up sections of an animation.  You are netter off juast keeping things in one scene so that you can keep things coded and refrenced cleanly.

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