// forked from mash's テキスト右そろえの質問
// テキスト右そろえにして、
// テキストフィールドの幅と高さを固定にする方法
// は無いものだろうか??
//TextFromatを使う?とかそういうことではなく?
//質問の意図勘違いしてたら、すみませぬ。
package {
import flash.display.Sprite;
import flash.text.*;
public class TextField_wordWrap extends Sprite {
public function TextField_wordWrap() {
var tfWrap:TextField = createTextField(10, 10, 100, 100);
tfWrap.wordWrap = true;
tfWrap.text = "(wordWrap = true):\nThis is very long text that will certainly extend beyond the width of this text field";
var tfNoWrap:TextField = createTextField(10, 150, 100, 100);
tfNoWrap.wordWrap = false;
tfNoWrap.text = "(wordWrap = false):\nThis is very long text that will certainly extend beyond the width of this text field";
var tfNoWrap2:TextField = createTextField(10, 290, 100, 100);
tfNoWrap2.wordWrap = true;
tfNoWrap2.text = "(wordWrap = true):\nThis is very long text that will certainly extend beyond the width of this text field ";
var format:TextFormat = new TextFormat();
format.align = "right"
tfNoWrap2.setTextFormat(format)
}
private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = true;
result.border = true;
addChild(result);
return result;
}
}
}