PDA

View Full Version : A very strange problem: MouseEvent



zhangxiaorui
September 14th, 2008, 01:09 PM
there is a moveclip a_mc and it contains a button: a_mc.b_btn

When using a_mc.b_btn.addEventListener(MouseEvent.CLICK, handler) i got nothing when the button is clicked, but if I use

a_mc.addEventListener(MouseEvent.CLICK, handler)

And the target in the handler is b_btn

Any one tell me why I cannot just listen to the event with the button!?

wvxvw
September 14th, 2008, 01:42 PM
Just make sure you haven't set mouseChildren of the parent MovieClip to false. Technically, what you're trying to do should work. Also, try to avoid referring clips by name, it's always better to have a variable pointing to clip, because the name may be changed later. Also make sure the inner clip exists in the first frame of the parent clip and has the name "b_btn".