all groups > flash actionscript > march 2007 >
You're in the

flash actionscript

group:

Menu Problem


Menu Problem ID. Awe
3/31/2007 7:24:56 PM
flash actionscript:
I have a menu with five buttons. On rollOver each button shows a flyout menu
with buttons. The problem is that once the sub-menu is out and you move your
mouse away too quickly, the sub-menu hangs out and stays there, a real mess
when the other sub-menus are rolled out.

It seems to work fine as long as you do not move your mouse too quickly.
Hmmmmmmm, strange.
Re: Menu Problem abeall
3/31/2007 10:16:06 PM
I've seen this so often over the years and honestly still don't quite know why
this is, except that it only seems to happen with gotoAndPlay(). Somehow the
playhead gets stopped, although the goto works. If you stick a trace command
inside rollOver and rollOut you'll see that they both always get triggered,
it's just that multiple calls to gotoAndPlay, gotoAndStop, play, and stop, can
often get tripped up over each other. You might think that it's simply a matter
of what gets called last, but I don't think that's the case.

So in short, see if you can restructure the menu in one of the following ways:
1) Use onEnterFrame to manually advance/rewind the playhead instead of using
play/stop, like this:
onRollOver = function(){
onEnterFrame = function(){
nextFrame(); // or prevFrame() to rewind
}
}

This is the method I often use, and it always works.

2) Divide your animations up into MovieClips, place them on single frames, and
simply call gotoAndStop to those frames on rollOver/Out, and let the nested
MovieClip handle the animation

3) Put play() commands on the timeline where goto actions will occur and
should play. This will sometimes override any stops that interfere with a
gotoAndPlay, usually.
Re: Menu Problem ID. Awe
4/1/2007 12:05:55 AM
beally: Thank you for the reply, I was thinking that my mouse was sick or that
it had something to do with the flash detector on the page.

The strange thing is that it works fine in the swf preview in Flash, but
screws up when you launch the HTML page in a browser.

I will work on your suggestions tomorrow to see if this clears it up. Will get
back with an answer or more questions with a posted .fla link.
Re: Menu Problem abeall
4/1/2007 12:20:54 AM
[quoted text, click to view]

Interesting, in that case it might be an issue of of the mouse leaving the
SWF? Flash does not track the mouse as it it is outside of the SWF. This means
that it thinks the mouse never leaves but rather has stopped somewhere in your
movie. If you move fast enough, the last place your mouse was in your movie
might be over the button, so it thinks it's still over the button. If you are
using a small SWF this can particularly be a problem.

There are some awkward workarounds using JavaScript that let you track this,
but I don't know any off hand, do a search for "Flash detect mouse leave stage"
or similar.

Additionally, Flash 9 and AS3 finally solved this problem by providing the
event "mouseLeave" dispatched when the user's mouse leaves the SWF:

http://livedocs.adobe.com/flex/2/langref/flash/display/Stage.html#event:mouseLea
ve

HTH
Re: Menu Problem ID. Awe
4/1/2007 1:12:24 AM
beally: Thank you for your continued interest, even though the flash movie
resizes to the full size of the browser window using Stage.scaleMode =
"noScale" & a sizeListener to resize certain element properly, it could
possibly be that I need a full background or not use the 'transparent
windowless' code.

Hmmmmmm, I'll throw that around tomorrow first, it that is not it, then I'll
work with your suggestions.
AddThis Social Bookmark Button