|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Flash CS3 - Button only works in one frame.
Howdy.
I'm pretty new to Flash in general and I'm trying to put together a basic presentation. I have a "back to menu" button (menu_btn) in several of the frames that my menu frame link to. The problem is that the back to menu button only works in one of those frames. I use the following code for the button: Code:
function goMenu (e:MouseEvent):void
{
gotoAndStop("Menu");
}
menu_btn.addEventListener(MouseEvent.CLICK, goMenu);
Here's what my timeline looks like. The first frame is the menu and the rest are the individual frames the menu links to. The button is in the Buttons layer on frames 2-5. It only works in frame 2. URL I went off of this tutorial to do it.. so it seems like it should work. Any ideas are appreciated. Thanks! |
|
#2
|
|||
|
|||
|
Hi, if you have the button in multiple keyframes then make sure you have given it the same instance name in them all. If the movie doesn't actually change in those other keyframes then just have it in the first keyframe and have normal frames after it instead, even if that means moving it onto its own layer.
|
|
#3
|
|||
|
|||
|
Thanks for the response.
I'm still having trouble getting it to work. It appears that the button has the same instance name in the set of frames it's in (2-5). When I tried creating a test flash with just 3 buttons that go to different frames, they all worked fine. But if I instead have a frame with 2 buttons that each go to different frames and share a "back" button, the back button still only works on the 1st one. I think I might not be using AS3 in frames properly. I've had trouble finding any tutorials with an example like this. I understand the general concept and it seems like it should work, but it doesn't. ![]() |
|
#4
|
|||
|
|||
|
So you have it layered like this?
![]() |
|
#5
|
|||
|
|||
|
It won't let me post a screencap of my timeline on here yet, but not exactly. I will try to explain it as best I can.
Layer 1 is "actions" Frame 1 (keyframe): AS3 code for the buttons on the menu that link to frames 2-5. Frame 2 (keyframe)-5: AS3 code for the "back to menu" button which should take you back to frame 1 from frames 2-5. Layer 2 is "buttons" Frame 1 (keyframe): Buttons for the menu. Frames 2 (keyframe)-5: Back to menu button. Layer 3 is "content". Every frame is a unique keyframe. Frame 1 is the menu content, the rest are each different frames of content. so frames 2-5 have the button to go back to frame 1, but the only frame that it works in is frame 2. if this is not the standard way to do something like this, feel free to let me know. I just kind of tried to whip up what seemed to make sense at the time. ![]() Thanks. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Flash CS3 - Button only works in one frame. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|