Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : button problem


JPI
6/22/2004 9:12:49 PM
I can't seem to get this button to trace("hi");
Can someone take a look at it?

Just change the filename from ".txt" to ".fla"

mandingo
6/22/2004 11:22:32 PM
Hi,

I can probably tell you why without looking at it. Your button instance is
nested in another movieClip. Because of that, the _parent movieClip is
intercepting your onClick behaviour and your button doesn't react.

You will need to test the mouse click and then see if it is over the button
with some sort of .hitTest();

I hope that helps,
cheers,
JPI
6/23/2004 4:50:04 PM
You are absolutely correct. I tried using a MovieClip as a button, and
nesting that, but still no effect. Plus the hit test has confirmed that the
_parent MovieClip is intercepting the click.
Is there a quick/dirty workaround for this, or am I back to square one?
Thanks in advance.
mandingo
6/23/2004 11:16:50 PM
Well, the way to do it is to determine the position of the click when you click
the _parent movie.

Then find the _root._xmouse and _root._ymouse positions and test if these
coincide with the position of the button...

With the button, it is usually best to make that a movieClip instance and not
an actual button. Then if your condition is met for the mouse being over the
button, it fires of the myButton.onRelease() function call instead.

Search the archives for 'nested buttons' or 'buttons in movieClips' and see
what you get... there have been thousands of posts on this and various neat
solutions.

cheers,
AddThis Social Bookmark Button