PDA

View Full Version : Nested MovieClip events.


peterpete
11-23-2010, 06:16 PM
Hello.

I have a Movieclip, let's call it mc. I have a second MovieClip called mc2 which is a child on mc. Normally if I wanted to add an event to mc2 I'd use mc2.addEventetc etc. However, this also selects the top level MovieClip, mc.

If I use the Flash graphical editor to place mc2 inside of mc, I can use mc.mc2. etc etc to access mc2, but I'm using:

mc.addChild(mc2);

So I can access mc2 and all of it's properties using mc2.etc etc, mc2.rotationY = 12; for example.

So, how can I detect, without an ENTER_FRAME and hit test, that I'm dispatching an event on mc2 and not mc?

Thank you.

Eralmidia
11-24-2010, 04:47 AM
When listening for an event, the event listener function will receive an event object as a paramter. This event object has two properties called .target and .currentTarget. http://www.wastedpotential.com/?p=10

Let me know if this wasn't what you really were asking about ;)