I'm having a similar issue. Event is dispatched (I can step through
code and see it) but the event listener is never hearing it, and so
the listener function is never being fired.

How does one tell if the listener is ready or not? If you add the
listener on the creationcomplete or initialize event of an mxml
component, it should in theory be ready to fire, for the duration of
the app, right? And if you're dispatching a custom event when an item
is selected in a combobox, it should certainly work. What could be the
reason for a 'deaf' event listener? :)

-- David

--- In [email protected], "Tracy Spratt" <tspr...@...> wrote:
>
> Perhaps the listener is not yet ready when the canvas creationComplete
> fires?
> 
> Tracy
> 
>  
> 
> ________________________________
> 
> From: [email protected] [mailto:[email protected]] On
> Behalf Of markflex2007
> Sent: Monday, January 05, 2009 2:08 PM
> To: [email protected]
> Subject: [flexcoders] why I can not dispatchEvent with creationComplete?
> 
>  
> 
> I try the following code, But I can not dispatchEvent.
> 
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
> <http://www.adobe.com/2006/mxml> "
> creationComplete="justLogin()" >
> <mx:Metadata>
> [Event(name="loginEvent", type="flash.events.Event")]
> </mx:Metadata>
> <mx:Script>
> <![CDATA[
> 
> 
> private function justLogin():void{ 
> 
> dispatchEvent(new Event("loginEvent", false));
> 
> }
> ]]>
> </mx:Script> 
> 
> </mx:Canvas>
> 
> I can dispatchEvent with button click, please let me know how to
> automatic dispatchEvent in page start.
> 
> Thanks
> 
> Mark
>


Reply via email to