Popups are not parented by the app so the event won't be seen the by app
listener.  IMHO, it is a bad practice to bubble like that.  You should
just get the reference to the popup from the PopUpManager and
addEventListener to that.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Parjan Arjan
Sent: Sunday, May 18, 2008 8:02 AM
To: [email protected]
Subject: [flexcoders] Event Not Dispatched From TileWindow



Dear All
I am dispatching an event from tile window and i am capturing this event
on parent container but event is not dispatching from tile window here
is my code can u point out what is wrong here thanks in advance..
Parkash Arjan
// This is my Event Class Code
    public class CloseMyTileWindowEvent  extends Event
    {
         public static var CLICK:String = "MY_TILE_WINDOW_CLICK_EVENT";
        
        public var str:Object;        
        
        public function CloseMyTileWindowEvent( str:Object )
        {
            super (CLICK, true, true);
            this.str = str;            
        }

    }

//This Is my Application Container
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="{init()}"  > 
<mx:Script>
    <![CDATA[
        import mx.managers.PopUpManager;
    public function init():void
    {                                            
        addEventL! istener( CloseMyTileWindowEvent.CLICK,
closeTileWindowEventHandler );            
    }
    
    public function closeTileWindowEventHandler():void
    {
        trace( "TileWindowEventHandlede" );
    }
    
     public function showMtTileWindow():void
     {
         PopUpManager.createPopUp( this , MyTileWindow , true );
     }    
    ]]>
</mx:Script>
    <mx:Button  label="Click-Me" click="{ showMtTileWindow() }"/>
</mx:Application>

//And This is my tile window which is dispatching event
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWin! dow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" width="400" height="300">
    <mx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            public function tileWindowButtonHandler():void
            {
                var evt:CloseMyTileWindowEvent = new
CloseMyTileWindowEvent( null )
                dispatchEvent( evt );
                PopUpManager.removePopUp( this );            
            }
    &! nbsp;   
        ]]>
    </mx:Script>    
    <mx:Button click="{ tileWindowButtonHandler() }"/>    
</mx:TitleWindow>


        


 

Reply via email to