flash on 2011-3-26

by tjoen
♥0 | Line 33 | Modified 2011-03-26 12:46:01 | MIT License
play

ActionScript3 source code

/**
 * Copyright tjoen ( http://wonderfl.net/user/tjoen )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/54FA
 */

<?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 mx.core.IFlexDisplayObject;
            import mx.events.CloseEvent;
            import mx.managers.PopUpManager;
            import spark.components.TitleWindow;
 
            protected var ttlWndw:TitleWindow;
 
            protected function btn_click(evt:MouseEvent):void {
                ttlWndw = new TitleWindow();
                ttlWndw.title = "Spark TitleWindow title";
                ttlWndw.width = 300;
                ttlWndw.height = 200;
                ttlWndw.addEventListener(CloseEvent.CLOSE, ttlWndw_close);
 
                PopUpManager.addPopUp(ttlWndw, this, true);
                PopUpManager.centerPopUp(ttlWndw);
            }
 
            protected function ttlWndw_close(evt:CloseEvent):void {
                PopUpManager.removePopUp(evt.currentTarget as IFlexDisplayObject);
            }
        ]]>
    </fx:Script>
 
</s:Application>