【解決法求む】TFの先頭行が切れる

by romatica
♥0 | Line 25 | Modified 2011-06-08 14:40:49 | MIT License
play

ActionScript3 source code

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

package {
    import flash.text.TextFieldAutoSize;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var str : String = "【解決法求む】TextFormatでleading指定した、テキストフィールド。";
            str += "\n" + "テキスト選択し、行末を超えてドラッグすると、";
            str += "\n" + "先頭行が切れる (Mac 10.6 「FP10.3.181.22」&「11.0.0.60 β」で確認)";


            var tfm : TextFormat = new TextFormat()
            tfm.leading = 10;

            // ----------------------------------------------------------------------
            // テキスト選択し、行末を超えてドラッグすると先頭行が切れる

            var _tf1 : TextField = addChild(new TextField()) as TextField;
            _tf1.defaultTextFormat = tfm;//leading適用
            _tf1.multiline = true;
            _tf1.text =str;
            _tf1.autoSize = TextFieldAutoSize.LEFT;

            // ----------------------------------------------------------------------            
            //これはleadingしてないので切れない

            var _tf2 : TextField = addChild(new TextField()) as TextField;
            _tf2.multiline = true;
         _tf2.text = "これはleadingしてないので切れない "+str;
            _tf2.autoSize = TextFieldAutoSize.LEFT;
         _tf2.y=150;
        }
    }
}

Forked