Who's dispatching and how?

 

When does the control get instantiated?  Could it be after
creationComplete?

 

If the controller is not a UIComponent, it will not get a
creationComplete.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dnk
Sent: Friday, May 23, 2008 4:48 AM
To: [email protected]
Subject: [flexcoders] custom event not added

 

Hi there,

I have a controller that is adding my custom event listeners, but for 
some reason my event handler was not being fired.

My original code was (snippet):

(in controler)

//constructor
public function FlexbController()
{
//turn the key, start it up....
addEventListener( FlexEvent.CREATION_COMPLETE, onInit );
}

private function onInit( event:Event ):void
{
//setup event listeners
/*systemManager is where event listener hangs out defines the 
relationship between event and handler*/

systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, 
handler_GetNewsEvent );
systemManager.addEventListener( AddNewsEvent.ADD_NEWS_EVENT, 
handler_AddNewsEvent );

systemManager.addEventListener( NewsDataLoadedEvent.NEWS_LOADED_EVENT, 
handler_NewsLoadedEvent );
getNewsData();

}

And I had trace statements in all of my handlers... this is how i 
noticed things were not working as they should.

SO I added a simple check like (in my FlexbController constructor):

if (systemManager.addEventListener( GetNewsEvent.GET_NEWS_EVENT, 
handler_GetNewsEvent ))
{
trace("true");
} else {
trace("false");
}

And I obviously am getting "false".

Ideas?

dnk

 

Reply via email to