If the object doesn’t exist yet, it can’t be listening, and one object needs to 
be created before the other.  It is rare to dispatch events from a constructor 
for that reason.  There are plenty of other lifecycle events you can use.

However, often the better solution is to have a central data model so the views 
listen to a model and not to each other.

From: [email protected] [mailto:[email protected]] On Behalf 
Of Berkay Unal
Sent: Friday, January 09, 2009 4:51 AM
To: [email protected]
Subject: [flexcoders] Custom Event problem?


Hi

I have 2 components. These two components both extends the core component 
"abilist".

<abi:CourseList width="400" height="300" />
<abi:CourseChapterList width="400" height="300" />

When abi:CourseList dispatches a custom event "AbiListEvent.COURSECHANGED"  it 
doesnt caught by abi:CourseChapterList by addEventListener in the constructor 
of the abi:CourseChapterList. I can catch it , if i assign by 
Application.application.addEventListener in the abi:CourseChapterList's 
constuctor.

Is there any other way to do this without "Application.application" and a 
framework?


Best,
Bunal

Reply via email to