forked from: タブストップが変

by psyark forked from タブストップが変 (diff: 17)
♥0 | Line 23 | Modified 2009-10-27 18:18:15 | MIT License
play

ActionScript3 source code

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

// forked from psyark's タブストップが変
package {
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.text.TextFormat;
        
    public class FlashTest extends Sprite {
        public function FlashTest() {
            var container:Sprite = new Sprite();
            var textField:TextField = new TextField();
            textField.defaultTextFormat =
                new TextFormat("_typewriter");

            textField.text =
                "if (hoge) {\n" +
                "\tif (fuga) {\n" +
                "\t\t// What?\n" +
                "\t}\n" +
                "}";
            addChild(container);
            container.addChild(textField);
            
            // 移動はコンテナを使えたとしても
            container.x = 20;
            // リサイズする際に絶対座標がずれてるとだめ
            textField.width = 300;
        }
    }
}

Forked