PopUpManager弹出窗口

时间:2023-07-06 18:37:02
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600"> <fx:Script>
<![CDATA[
import mx.controls.Label;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
import spark.components.TitleWindow;
public var window:TitleWindow = new TitleWindow();
private var titleWindow:TitleWindow;
private function buttonClickHandler1(event:MouseEvent):void
{
window.title="New Title";
//PopUpManager.addPopUp(window, this,true);
PopUpManager.addPopUp(window, this,false);
PopUpManager.centerPopUp(window);
} private function buttonClickHandler2(event:MouseEvent):void
{
PopUpManager.removePopUp(window);
titleWindow = TitleWindow(PopUpManager.createPopUp(this,TitleWindow,true));
titleWindow.title="New TitileWindow";
PopUpManager.centerPopUp(titleWindow);
}
]]>
</fx:Script> <fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:VGroup>
<s:Button id="button1" label="btn1" click="buttonClickHandler1(event)"/>
<s:Button id="button2" label="btn2" click="buttonClickHandler2(event)"/>
</s:VGroup>
</s:Application>