Skip to main content
joec12683546
Known Participant
February 2, 2018
Answered

can't figure out how debug actionscript to move from frame to frame using labels

  • February 2, 2018
  • 1 reply
  • 363 views

The timeline I've composed is considerably more complicated than this, but basically the following setup is a proxy for the problem I'm having......

Given 5 labeled keyframes spaced out at one every 20 frames across 100 frames of one layer.

So.........

label1...........label2.............label3...........label4............label5

There are 5 button symbols in various places on the timeline, and each is consecutively addressed to a label

So......

button1.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_76);

function fl_ClickToGoToAndStopAtFrame_76(event:MouseEvent):void

{

gotoAndStop("label1");

}

and so on........

So why can't I hop around randomly from label to label using these buttons?

If I click them in order....button1 then button2 then button3, etc., the hops are all executed, but if I don't click them consecutively, one button or another is temporarily deactivated somehow.....for example, clicking button1, then button4 then button2, then button5 then button3......a disordered sequence like this won't work- one or more of the buttons deactivates. I can pick the deactivated ones up again by finding one that is still active and moving to its label, then the others are reactivated....I don't understand why, and I can't find any solutions to this problem....has anyone encountered this kind of problem and found a solution?.

Thanks in advance

This topic has been closed for replies.
Correct answer kglad

put all that goto code for all 5 buttons in frame 1 and place all 5 buttons on stage at frame 1.

then use removeChild() and addChild() (or the visible property) to have your buttons appear in the frames you want.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 2, 2018

put all that goto code for all 5 buttons in frame 1 and place all 5 buttons on stage at frame 1.

then use removeChild() and addChild() (or the visible property) to have your buttons appear in the frames you want.