//自定义事件 类型为定义的事件类型 <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:Metadata> [Event(name="sc",type="loginEvent")] </mx:Metadata> <mx:Script> <!--[CDATA[ import flash.events.TextEvent; private function ff(event:Event):void { var e:loginEvent=new loginEvent("sc"); var a:Object=new Object(); a.username="jj"; a.pwd="ww"; e.user=a; dispatchEvent(e); } ]]--> </mx:Script> </mx:Canvas>