Ok i have included a next button on my first 5 frames and placed the one code for that button in another layer so it corresponds to all the next buttons.

once published i have noticed that it works fine if i have the next button on every page, however the problem occurs when i remove one next button from say frame 3 and then once i skip to frame 4 using a sidrebar button the next btuuon does not operate on that page? Its as if flash wants me to have it on every page so that it works?

Dani AI

Generated

The symptom you saw (button works for the first frames but not after jumping/skipping frames) almost always comes from how the Flash timeline creates separate instances for each keyframe. That detail explains why the same-looking button can lose its click behavior: an event listener attached to one instance does not automatically attach to a different instance that Flash creates on a later keyframe.

Clarifying the cause and two practical fixes (keeps , and in context)

  • Why it happens: each keyframe can contain a distinct object instance. If your listener is added only when the first instance exists, later instances (even with the same symbol and instance name) will not have that listener.
  • Robust fix 1 (centralized handling): use one controller that listens at a parent/stage level and routes clicks instead of adding a listener to each button instance. Example (AS3):
    stage.addEventListener(MouseEvent.CLICK, stageClick);
    function stageClick(e:MouseEvent):void {
      var t:DisplayObject = e.target as DisplayObject;
      while(t && t.name != "next_btn") t = t.parent;
      if (t) MovieClip(root).gotoAndStop(MovieClip(root).currentFrame + 1);
    }
  • Robust fix 2 (attach when the instance appears): detect when the instance is present and add the listener at that moment (use ADDED/ADDED_TO_STAGE or a short init routine that checks for the instance). This avoids duplicating navigation code across frames.

Quick troubleshooting checklist

  • Confirm the instance name in the Properties panel (exact spelling).
  • Use a trace or debug print to confirm the object exists on the frame you land on.
  • If you must keep multiple keyframe instances, reattach the listener when the playhead hits that frame (or use the central handler above).
  • For AS2 the same instance-vs-keyframe rule applies; use onRelease handlers on each instance or a parent-level handler.

These approaches give a stable UI regardless of how the timeline is navigated and explain why per-frame code (what you ended up using) appeared to “fix” the issue.

Recommended Answers

All 9 Replies

Member Avatar for Member #114696

Cant help much without looking at source fla. But why whould you need to put same button with same code on every keyframe. Rather make a new layer and say you have 5 keyframe, just put frame till there on button layer.

PS: Be careful, Keyframes and Frames are different.

yes that is what im saying, ive put the one code for the next buttons on a different layer (action layer) so that i dont have to write the code individually for every frame.

Member Avatar for Member #114696

Yeah, but you still have inserted button on every keyframe. Better put it one one keyframe on another layer and extend the frame till end. Again I cant help much without source!

ok just attached the source file so you can have a look at m8, as requested.

Member Avatar for Member #114696

Oups, I think you've got Flash CS4 because I cant open the FLA. I have CS3.

yes i have got cs4 i thought you knew that. despite this altercation and it not being solved i must say i really appreciate you spending your time and the length of your efforts to solve my problem m8.
I made this rule up that for every post i put on i should attempt to solve at least one of someone else's.

Member Avatar for Member #114696

Hey, do this....File>Save As... and on "Save as Type" combo select CS3 version. Every version of flash till now has an option to save FLA in its predecessor's format.

Member Avatar for Member #334542

Actually you have not use the next button in a single frame, Instead of that you used the next button in several frames.

You should place more codes relevant to the button location (frame).Please look into the attachment for your solution.

yea cheers rajar, i decided to do what you suggested and to individually provide the code for each cluster of frames i put the button on, instead of providing one piece of code for all the buttons on another layer. Im starting like you rajar

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.