Unfortunately, only UIComponents can bubble events, because the bubble hierarchy is the display list. If you need to dispatch bubbling events from a non-visual component, you can use Application.application, look up the SystemManager and use that (it's how I usually do it), or you can implement IMXMLObject, and (usually) use the "Document" parameter passed to initilialized().
-Josh On Tue, Sep 2, 2008 at 1:42 AM, guillaumeracine <[EMAIL PROTECTED]>wrote: > I made a custom event called TreeDataLoadedEvent. > In my Application.mxml, i add a listener to this event in the > creationComplete phase. > The TreeDataLoadedEvent is dispatched by a custom class named ModelLocator > that extends EventDispatcher. > The ModelLocator class is instanced in Application.mxml. > > It seems that Application.mxml does not receive the event at all... > I wonder if it is because ModelLocator is not directly a child of the main > application...? > > How i can dispatch an event to the application that is not a child of type > DisplayObject? > > Code : > > <mx:Application > xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" > creationComplete="creationCompletedHandler(event);"> > > <mx:Script> > <![CDATA[ > import events.TreeDataLoadedEvent; > import model.ModelLocator; > import mx.controls.Alert; > > public var modelLocator:ModelLocator = > ModelLocator.getInstance(); > > private function creationCompletedHandler(evt:Event):void{ > this.addEventListener( > TreeDataLoadedEvent.LOAD_COMPLETED_EVENT, eventReceived ); > } > > private function btnClicked(evt:Event):void{ > modelLocator.dispatchEvent( new TreeDataLoadedEvent() );// > In the constructor i call super("goodType",true) > } > > private function eventReceived(evt:Event):void{ > Alert.show("Event received!"); *//this is never shown* > } > > ]]> > </mx:Script> > > <mx:Button id="btn" x="209" y="299" label="Button" > click="btnClicked(event);"/> > > </mx:Application> > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

