I'm launching a popUp with a custom component inside through PopUpManager. This custom component has a button that when pressed dispatches an event. The launcher application is subscribed to this event but the event never gets to the listener.
Here's the code:
FILE: Launcher.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml " layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.containers.TitleWindow;
import mx.managers.PopUpManager ;
public function init():void {
addEventListener("testEvent",myListenerFunc);
}
public function launch():void {
var win:TitleWindow = PopUpManager.createPopUp(this,TitleWindow,true) as TitleWindow;
win.title = "Hello World";
PopUpManager.centerPopUp(win);
win.addChild (new FloatingPanel());
//win.addEventListener("testEvent",myListenerFunc);
}
public function myListenerFunc(evt:Event):void {
trace ("aquĆ");
}
]]>
</mx:Script>
<mx:Button label="launch" click="launch()"/>
</mx:Application>
FILE: FloatingPanel.mxml
<?xml version=" 1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
<mx:Script>
<![CDATA[
import flash.events.Event;
public function launch():void {
dispatchEvent(new Event("testEvent",true));
}
]]>
</mx:Script>
<mx:Button label="hello" click="launch()"/>
</mx:Canvas>
Am I missing something about event bubbling? If I uncomment the line //win.addEventListener("testEvent",myListenerFunc); then all works fine. But in the code I'm working on can't use this workarround because I don't know which will be the raised events.
Thanks in advance
best
X.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.