forked from: なんでこれコンパイルエラーなの?

by ProjectNya forked from なんでこれコンパイルエラーなの? (diff: 2)
♥0 | Line 27 | Modified 2011-09-28 17:23:52 | MIT License
play

ActionScript3 source code

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

// forked from 9balls's なんでこれコンパイルエラーなの?
package {
    import flash.text.TextFieldAutoSize;
    import flash.text.TextField;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var tf:TextField = new TextField();
            tf.autoSize = TextFieldAutoSize.LEFT
            addChild(tf);
            //
            tf.appendText(String(2 + 1 + ""));// 3
            tf.appendText("\n");
            tf.appendText(String(2 - 1 + ""));// 1
            tf.appendText("\n");
            tf.appendText(String("" + 2 + 1));// 21
            tf.appendText("\n");
            tf.appendText(String("" + 2 - 1));// 1
            tf.appendText("\n");
            tf.appendText(String(1 + "" + 2 + 1));// 121
            tf.appendText("\n");
            tf.appendText(String(1 + "" + 2 - 1));// 11
            tf.appendText("\n");
            tf.appendText(String("" + 1 + "" + 2 + 1));// 121
            tf.appendText("\n");
            //tf.appendText(String("" + 1 + "" + 2 - 1));// エラー
            tf.appendText(String("" + 1 + "" + (2 - 1)));// 11
        }
    }
}