forked from: 改行のバグ?

by undo forked from 改行のバグ? (diff: 4)
♥0 | Line 22 | Modified 2010-12-21 15:03:41 | MIT License
play

ActionScript3 source code

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

// forked from sakusan393's 改行のバグ?
package {
    import flash.text.TextFormat;
    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();
            var tfm:TextFormat = new TextFormat("_ゴシック", 30);
            tf.defaultTextFormat = tfm;
            tf.border = true;
            tf.width = tf.height = 400;
            addChild(tf);
            tf.x = tf.y = 32;
            
            var str:String = "ほげ\rもじゃ\nぶらふ";
            //tf.appendText( str );
            //最初だけ直接代入すれば大丈夫かも
            tf.text = str;
            tf.appendText( "\n=====\n" );
            
            tf.text += "\n-----\n";            
            tf.text += str;
            tf.text += "\n=====\n";
        }
    }
}