In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: AS3 はかわいい

まさかのコンパイラによる最適化ですか? 
僕はAS3のコンパイラは何も最適化しないって信じてたのに・・・
Get Adobe Flash player
by 9re 26 Apr 2011
    Embed
/**
 * Copyright 9re ( http://wonderfl.net/user/9re )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gya7
 */

// forked from bkzen's AS3 はかわいい
/*
 * まさかのコンパイラによる最適化ですか? 
 * 僕はAS3のコンパイラは何も最適化しないって信じてたのに・・・
 */
package 
{
    import flash.text.TextFormat;
    import flash.text.TextField;
    import flash.display.Sprite;
    
    public class FlashTest extends Sprite 
    {
        private var txt:TextField;
        
        public function FlashTest() {
            // write as3 code here..
            addChild(txt = new TextField());
            txt.defaultTextFormat = new TextFormat("Verdana");
            txt.width = stage.stageWidth, txt.height = stage.stageHeight;
            trace("added TextField, numChildren == " + numChildren); // 1
            var a:XMLList = <>{addChild(new Sprite())}</>;
            trace("numChildren: ", numChildren); // 1
            trace(<>{addChild(new Sprite())}</>); // [object Sprite]
            trace("numChildren: ", numChildren); // 2
            trace(<>{trace("test")}</>);
            trace("------");
            var b:XMLList = <>{addChild(new Box())}</>;
            trace("numChildren: ", numChildren); // 2
            trace(<>{addChildAt(new Box(),0)}</>); // [object Sprite]
            trace("numChildren: ", numChildren); // 3
            trace("------");
            var c:XMLList = <>{trace("mojaA")}</>;
            var d:XMLList = (<>{trace("mojaB")}</>);
            1&&(<>{trace("mojaC")}</>);
        }
        
        private function trace(...args):void
        {
            txt.appendText("" + args.join(" ") + "\n");
        }

    }
}
import flash.display.Sprite;
class Box extends Sprite
{
    function Box()
    {
        graphics.beginFill(0xCCCCCC, 0.3);
        graphics.drawRect(10,100,200,200);
    }

}