Flex3.0&AS3 2008. 10. 1. 17:16

flex_popup 띄우기

/*팝업띄우기*/

<mx:Script>
   <![CDATA[
    import mx.managers.PopUpManager; //팝업메니져
    import comp.popup.lessonMngPopup; //팝업대상
    
     public function showPopup(e:MouseEvent):void{
        var popup:* = lessonMngPopup(PopUpManager.createPopUp(this, lessonMngPopup, true )); 
        popup.owner = this;
     }
   ]]>
  </mx:Script>

/*팝업 센터 위치시키기*/
<mx:Script>
   <![CDATA[
    import mx.containers.TitleWindow;
    import mx.managers.PopUpManager;
     private function lessonSch():void{  
     var popWindow:TitleWindow=TitleWindow(PopUpManager.createPopUp(this,progEduLessonMngSch, true));     
     PopUpManager.centerPopUp(popWindow); 
     }
   ]]>
  </mx:Script>
위의 방법은 약간의 버그로 인해서 아래처럼 사용하는것을 추천

   var popupWindow:Object = PopUpManager.createPopUp( this, centerAdminSetSubmit, true );
   popupWindow.x = ( parentApplication.width - popupWindow.width ) / 2;
   popupWindow.y = ( parentApplication.height - popupWindow.height ) / 2;




/*팝업 닫기*/
<mx:Script>
   <![CDATA[
    import mx.managers.PopUpManager;
    import mx.events.ModuleEvent;
     private function closePopup(e:MouseEvent):void{
      PopUpManager.removePopUp(this);
     }
   ]]> 
  </mx:Script>