flash on 2011-5-11

by bkzen
右クリックしてコンテキストメニューから
「設定」を選らんだ時に出る設定ウィンドウも(たぶん) DisplayObject なんだね。
参照はできないけど。

@author jc at bk-zen.com
♥0 | Line 37 | Modified 2011-05-11 19:51:47 | MIT License
play

ActionScript3 source code

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

package  
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    
    /**
     * 右クリックして設定をクリックした時の設定ウインドウも何かしらのオブジェクト?
     * @author jc at bk-zen.com
     */
    [SWF (backgroundColor = "0xFFFFFF", frameRate = "30", width = "465", height = "465")]
    public class Test41 extends Sprite 
    {
        private var txt: TextField;
        
        public function Test41() 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e: Event = null): void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            //
            addChild(txt = new TextField());
            txt.width = stage.stageWidth;
            txt.height = stage.stageHeight;
            addEventListener(Event.ENTER_FRAME, loop);
        }
        
        private function loop(e:Event):void 
        {
            var n: int = stage.numChildren;
            var str: String = "";
            if (n == 1) str += "右クリックしてコンテキストメニューから「設定」を選択してみてください。\n";
            str += "stage.numChildren == " + n + "\n";
            var i: uint;
            for (i = 0; i < n; i++) 
            {
                str += "stage.getChildAt(" + i + ") == " + stage.getChildAt(i) + "\n";
            }
            txt.text = str;
        }
        
    }

}