Mark,
dispatchEvent(new Event("loginEvent", false));
The second parameter above, false, means the event will not bubble up.
Unless you are
going to be adding an eventListener to this Canvas, you most likely want that
second
parameter to be "true".
HTH,
Bart
--- In [email protected], "markflex2007" <markflex2...@...> wrote:
>
> I try the following code, But I can not dispatchEvent.
>
> <mx:Canvas xmlns:mx="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
>