Perhaps the listener is not yet ready when the canvas creationComplete
fires?

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of markflex2007
Sent: Monday, January 05, 2009 2:08 PM
To: flexcoders@yahoogroups.com
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