Hi everyone,

I cannot help you Roman to solve your problem, but I am able to
CONFIRM your bug( "feature") with FlexEvent.SHOW event not dispatched
from popUp window instance in modal mode if it is being shown for the
second and for the next time and so on.

In the attached sample application try to open both kinds of popup
windows (NORMAL, MODAL) by clicking buttons and then close open popup
windows several times with a mouse click on popup's window surface. 

 "onShow" event handler for FlexEvent.SHOW is being executed only for
when NORMAL popup window becomes visible at the screen. 

Full working code sample follows: 
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>      
<mx:Script>
        <![CDATA[
                import mx.containers.Tile;
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                import mx.core.IFlexDisplayObject;
                import mx.containers.TitleWindow;
                import mx.managers.PopUpManager;
                
                public var myModalPopUp : TitleWindow;
                
                public var myNormalPopUp : TitleWindow;
                
                function openPopUpWindow(isModal : Boolean, windowTitle : 
String) :
void {
                        
                        if (isModal) {
                                if (myModalPopUp == null) {
                                        myModalPopUp = new TitleWindow();       
        
                                        assignWindowProperties(myModalPopUp, 
windowTitle);                      
                                }                                               
                
                                PopUpManager.addPopUp(myModalPopUp, this, 
isModal);                     
                                PopUpManager.centerPopUp(myModalPopUp);
                        
                        } else {
                                if (myNormalPopUp == null) {
                                        myNormalPopUp = new TitleWindow();      
                                
                                        assignWindowProperties(myNormalPopUp, 
windowTitle);
                                } 
                                
                                PopUpManager.addPopUp(myNormalPopUp, this, 
isModal);                    
                                PopUpManager.centerPopUp(myNormalPopUp);
                        }                                               
                }
                
                private function assignWindowProperties(myPopUp : TitleWindow,
windowTitle : String) : void {
                myPopUp.height= 150;
                myPopUp.title = windowTitle;
                        myPopUp.addEventListener(MouseEvent.CLICK, closeWindow);
                        myPopUp.addEventListener(MouseEvent.CLICK, closeWindow);
                        myPopUp.addEventListener(FlexEvent.SHOW, onShow);   
        }
        
                public function closeWindow(event:MouseEvent) : void {        
           
PopUpManager.removePopUp(IFlexDisplayObject(event.currentTarget));
        }    
        
        private function onShow(evt : FlexEvent) : void {
                Alert.show("hello!");
        }
        
        
        ]]>
</mx:Script>
<mx:Button id="btn" click="openPopUpWindow(true, 'I am modal window')"
label="open Modal Window">
        
</mx:Button>
<mx:Button id="btn2" click="openPopUpWindow(false, 'I am normal
window')" label="open Normal Window">
        
</mx:Button>
        
</mx:Application>
-------------------

Reply via email to