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

\nが\rに変換される事の検証 forked from: 改行のバグ?

Get Adobe Flash player
by esukei 21 Dec 2010
/**
 * Copyright esukei ( http://wonderfl.net/user/esukei )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/A106
 */

// forked from sakusan393's 改行のバグ?
/**
 * http://fumiononaka.com/TechNotes/Flash/FN0712001.htm
 * [*5] TextField.textプロパティに改行文字"\n"を設定しても、復帰文字"\r"に変換されます。
 * の検証
 */
//
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 tf2:TextField = new TextField();
            var tfm:TextFormat = new TextFormat("_ゴシック", 30);
            tf.defaultTextFormat = tfm;
            tf.border = true;
            tf.width = 200;
            tf.height = 400;
            addChild(tf);
            tf.x = tf.y = 32;

            //\nを使って改行追加
            tf.text = "ほげ\nもじゃ\nぶらふ";
            
            tf2.defaultTextFormat = tfm;
            tf2.border = true;
            tf2.width = 200;
            tf2.height = 400;
            addChild(tf2);
            tf2.x = 232;
            tf2.y = 32;
            
            tf2.appendText(tf.text);
            tf2.appendText(tf.text);
            
        }
    }
}