all groups > flash (macromedia) > december 2005 >
You're in the

flash (macromedia)

group:

Button events triggering from behind MovieClip


Button events triggering from behind MovieClip gamutalarm
12/13/2005 10:58:20 PM
flash (macromedia): Hello, all. This one really has me stumped.

I've created a MovieClip "pop-up dialog" which appears onscreen when the
'print' button is released. There's nothing fancy about the pop-up MC -- it
contains a background, a couple of input fields and two buttons. The problem
is, if this pop-up is positioned over a button on the stage -- the pop-up is
visually and physically *on top* of the button -- you can trigger the button's
event handlers by clicking on the pop-up. In other words, the button is
triggered *through* the pop-up movieclip!

It isn't a depth issue, as far as I can tell. In fact, if I swap depths with
the offending button, the pop-up MC disappears behind the button (which is what
I would expect, given that the pop-up MC has a higher depth than the button).

The pop-up MC has no event handlers, although it contains buttons that do.

I'm a long-time developer and I've never come across this sort of behaviour.
Any ideas on what would cause this to happen? Am I missing something stupid and
obvious?

Thanks so much, guys.
Re: Button events triggering from behind MovieClip NSurveyor
12/13/2005 11:06:24 PM
If the pop-up MC has a button event handler (like onRollOver, onPress) this
will fix your problem. Button events still occur even if there is something on
top of it, however if a symbol has a button event that is placed above it, the
overlying clip will "intercept" the events. If you want to stop everything from
working... you could do the following:

Open up your pop-up dialog. Create a new layer (below the rest of the layers).
Using the Rectangle tool, drag a filled rectangle big enough to cover
everything on stage. Then select it, and go to Modify > Convert to Symbol (or
Insert > Convert to Symbol if you have older version of flash). Select the
'Button' radiobutton and hit OK. Double click your new button to enter it's
edit mode. Drag the Up frame (the first frame) onto the HIT frame (the fourth
frame). Exit the edit mode and return to the pop-up dialog's edit mode. You're
button will now appear to be a see through blue (this indicates that it is
invisible). Click on it and open the Properties Panel. Type in clickBlock_btn
for the <Instance Name> Then, on the first Frame of the layer, add the
following actionscript:

clickBlock_btn.onPress = function(){};
clickBlock_btn.useHandCursor = false;
AddThis Social Bookmark Button