Skip to main content
September 15, 2009
Question

Listening for events

  • September 15, 2009
  • 1 reply
  • 1181 views

I have three classes. Class1 instantiates class2 and class2 instantiates class3. Class1 is attached to the main movie, class2 is attached to MC2 and class3 is attached to MC3. MC2 is on the stage, and holds MC3.

When I listen for events from MC2 to MC3, I do something like this inside class2:

MC3.addEventListener(Class3.QL_MENU_OPEN, openQLMenu);

If I try to listen for the same event from the main movie, I tried something like this.

MC2.MC3.addEventListener(QuickLinks.QL_BUTTON_CLICK, traceThis);

But it did not work. How would I do this? I want to be able to listen to events in MC3 from the main movie.

Thanks a lot!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 15, 2009

if trace(MC2.MC3) reveals class3, then your reference is ok.  does it?

and, if so, where's traceThis()?

September 15, 2009

Yes, if I trace that, I get the name of class3.

traceThis is a method in the same class.

The error I am getting is: 1120: Access of undefined property class3.