views:

33

answers:

2

I am doing a simple Flash button that controls the playing of a moving clip.

I want the movie to go to frame one and play when I mouse over the button and I want it to go to frame 12 and play when I mouse out. I have stop(); at frames 1, 12 and 25 to prevent looping.

The mouse_over part works fine, but the mouse_out part is unresponsive.

Here is my actionscript:

stop();

button_btn.addEventListener(MouseEvent.MOUSE_OVER, playMovie);
button_btn.addEventListener(MouseEvent.MOUSE_OUT, unwindMovie);

function playMovie(evtObj:MouseEvent)
{
gotoAndPlay(1);
}

function unwindMovie(evtObj:MouseEvent)
{
gotoAndPlay(12);
}

I would appreciate some help figuring out why this will not play properly.

Thanks.

A: 

I'd like to see more of your code. I am assuming this is on the timeline, so my first question is, "Whre is the code?"

Timeline code responds to keyframes as well, so if it exists in one place, but not at the next keyframe, it will be unresponsive. A good stratagy is create one layer with no keyframes/graphics that holds all this kind of code, that way it will always be available.

But let me know some more info if the above isn't the issue, andwe can sort it out.

Tyler Egeto
Thanks for responding. I have it in frame one, but on that same line I also have stop(); action added to frames 12 and 25.Your comment makes sense. The if I remove the actions at 12 and 25, I need the mouse_over to play from 1 to 12 and then the mouse out to play from 12-25. So I could use some help with that part. Thanks again.
fmz
You could leave your stop commands where they are, just move the event stuff onto a new layer that doesn't have any keyframes, that way the mouse handling stuff is always available.
Tyler Egeto
Good idea. I have done that, but for some reason the mouse_out does not trigger properly.
fmz
does it make any difference if I use evtObj:MouseEvent or mouse:MouseEvent?
fmz
+1  A: 

I found my answer. The button was covering the entire surface of the swf file and therefore the file had no way of knowing that the mouse had left. I will still give credit to Tyler because I wouldn't have figured this out without his help. Thanks. Tyler.

fmz