Window Component:
<?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2009/10/23/displaying-a-popup-spark-titlewindow-container-in-flex-4/ --> <s:Application name="Spark_TitleWindow_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"> <s:controlBarContent> <s:Button id="btn" label="Show TitleWindow" click="btn_click(event);" /> </s:controlBarContent> <fx:Script> <![CDATA[ import comps.MyTitleWindow; import mx.managers.PopUpManager; protected function btn_click(evt:MouseEvent):void { var ttlWndw:MyTitleWindow = PopUpManager.createPopUp(this, MyTitleWindow, true) as MyTitleWindow; PopUpManager.centerPopUp(ttlWndw); } ]]> </fx:Script> </s:Application>
Main
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/10/23/displaying-a-popup-spark-titlewindow-container-in-flex-4/ -->
<s:TitleWindow name="MyTitleWindow"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
title="Spark TitleWindow title"
width="300" height="200"
close="ttlWndw_close(event);">
<fx:Script>
<![CDATA[
import mx.core.IFlexDisplayObject;
import mx.events.CloseEvent;
import mx.managers.PopUpManager;
protected function ttlWndw_close(evt:CloseEvent):void {
PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);
}
]]>
</fx:Script>
</s:TitleWindow>
沒有留言:
張貼留言