Skip to main content
Participant
March 22, 2011
Answered

Buttons taking me to the wrong scenes! Help!

  • March 22, 2011
  • 1 reply
  • 805 views

Okay, so I've got a website I've been working on. I've finally figured out how to get the buttons to work, BUT, now, they're taking me to the wrong scene.

like, say, it should take me to Scene 4, it takes me to Scene 2.  What's going on and how can I fix it?

This topic has been closed for replies.
Correct answer Ned Murphy

How would I use and save files as Movie Clips?


You don't.  You save what you are creating as a scene as a movieclip.  To do that you just copy the timeline of the scene into the timeline of an empty movieclip.  Then you can place that movieclip into the one main timeline, assign a label for the frame, and you don't have to deal with targeting scenes in your button code. But you still need to assign your event listeners to the buttons.

1 reply

Ned Murphy
Legend
March 22, 2011

Show the code that is not working.

DaemonDGAuthor
Participant
March 22, 2011

There are several. They work, but take you to the wrong scene. Could it be that they are the same buttons on 4 different scenes, minus function names?

Here is one of them.

stop();

addEventListener(MouseEvent.MOUSE_DOWN, myBtnasdfasdfasdfHandsler);

function myBtnasdfasdfasdfHandsler(event:MouseEvent):void {

    gotoAndStop(1, "Scene 4");

}

Now, this code WILL take me to another scene, no doubt. But it usually takes me to the wrong one.

DaemonDGAuthor
Participant
March 22, 2011

That event listener is not being assigned to a button, so if you have several similar bits of code in one place it is bound to fail... I can't say for sure, but I'd guess the last would prevail.

Another thing, you should probably use the CLICK event if the intention is to click a button.  A MOUSE_DOWN event can invoilve the start of someone changing their mind about clicking something after they already pressed down and then attempt to slide off before release to avoid the click completing.

When you use scenes with navigation, you run the chance of the navigation failing... it's just something that is a frequent issue with using scenes.  I never use them.  You are generally better off just using the one main scene's timeline and dividing it into sections and/or using movieclips for them.


How would I use and save files as Movie Clips?