※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!
wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)
thanks!
Weirdness of the height property of TextField forked from: Weirdness of the height property of TextField
- // forked from 9re's Weirdness of the height property of TextField
- package
- {
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- import flash.text.TextFormat;
- import flash.text.TextFormatAlign;
- // http://level0.kayac.com/2009/08/post_39.php
- public class TextFieldAutoSizeExample_0 extends Sprite
- {
- private const MAX_SIZE:int = 32;
- private const MIN_SIZE:int = 8;
- public function TextFieldAutoSizeExample_0()
- {
- var tf:TextField = new TextField();
- var tfm:TextFormat = new TextFormat("_sans", 12, 0, null, null, null, null, null, TextFormatAlign.JUSTIFY);
- var i:int = MAX_SIZE;
- var str:String = "Flash Player Bug??\n\nFlash Player sometimes fails to get proper height of TextField. This may issue from internal text rendering process. You can avoid this problem by executing getter method - the height property is internally implemented as getter and setter method - before using the height property. If you comment out the line 39, the code fails to work properly.这是中文测试,前述の通り、ビルトインクラスのプロパティの多くはアクセサであるため、少し予想外の挙動となってしまうことがあります。前述の通り、ビルトインクラスのプロパティの多くはアクセサであるため、少し予想外の挙動となってしまうことがあります。前述の通り、ビルトインクラスのプロパティの多くはアクセサであるため、少し予想外の挙動となってしまうことがあります。";
- stage.scaleMode = StageScaleMode.NO_SCALE;
- tf.autoSize = TextFieldAutoSize.LEFT;
- tf.wordWrap = true;
- tf.multiline = true;
- tf.text = str;
- tf.width = 300;
- tf.height = 1;
- addChild(tf);
- var tfHeight:int;
- while (i >= MIN_SIZE) {
- tfm.size = i--;
- tf.setTextFormat(tfm);
- // the follwing line avoids the problem
- tf.height;
- tfHeight = tf.height;
- if (tfHeight < 300)
- break;
- }
- tf = new TextField();
- tf.width = 200;
- tf.text = "fontSize: " + i.toString() + " tf.height: " + tfHeight.toString();
- tf.x = 310;
- addChild(tf);
- }
- }
- }
Weirdness of the height property of TextField forked from: Weirdness of the height property of TextField
- // forked from 9re's Weirdness of the height property of TextField
- package
- {
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- import flash.text.TextFormat;
- import flash.text.TextFormatAlign;
- // http://level0.kayac.com/2009/08/post_39.php
- public class TextFieldAutoSizeExample_0 extends Sprite
- {
- private const MAX_SIZE:int = 32;
- private const MIN_SIZE:int = 8;
- public function TextFieldAutoSizeExample_0()
- {
- var tf:TextField = new TextField();
- var tfm:TextFormat = new TextFormat("_sans", 12, 0, null, null, null, null, null, TextFormatAlign.JUSTIFY);
- var i:int = MAX_SIZE;
- var str:String = "Flash Player Bug??\n\nFlash Player sometimes fails to get proper height of TextField. This may issue from internal text rendering process. You can avoid this problem by executing getter method - the height property is internally implemented as getter and setter method - before using the height property. If you comment out the line 39, the code fails to work properly.";
- stage.scaleMode = StageScaleMode.NO_SCALE;
- tf.autoSize = TextFieldAutoSize.LEFT;
- tf.wordWrap = true;
- tf.multiline = true;
- tf.text = str;
- tf.width = 300;
- tf.height = 1;
- addChild(tf);
- var tfHeight:int;
- while (i >= MIN_SIZE) {
- tfm.size = i--;
- tf.setTextFormat(tfm);
- // the follwing line avoids the problem
- tf.height;
- tfHeight = tf.height;
- if (tfHeight < 300)
- break;
- }
- tf = new TextField();
- tf.width = 200;
- tf.text = "fontSize: " + i.toString() + " tf.height: " + tfHeight.toString();
- tf.x = 310;
- addChild(tf);
- }
- }
- }
Weirdness of the height property of TextField forked from: Weirdness of the height property of TextField
- // forked from 9re's Weirdness of the height property of TextField
- package
- {
- import flash.display.Sprite;
- import flash.display.StageScaleMode;
- import flash.text.TextField;
- import flash.text.TextFieldAutoSize;
- import flash.text.TextFormat;
- import flash.text.TextFormatAlign;
- // http://level0.kayac.com/2009/08/post_39.php
- public class TextFieldAutoSizeExample_0 extends Sprite
- {
- private const MAX_SIZE:int = 32;
- private const MIN_SIZE:int = 8;
- public function TextFieldAutoSizeExample_0()
- {
- var tf:TextField = new TextField();
- var tfm:TextFormat = new TextFormat("_sans", 12, 0, null, null, null, null, null, TextFormatAlign.JUSTIFY);
- var i:int = MAX_SIZE;
- var str:String = "Flash Player Bug??\n\nFlash Player sometimes fails to get proper height of TextField. This may issue from internal text rendering process. You can avoid this problem by executing getter method - the height property is internally implemented as getter and setter method - before using the height property. If you comment out the line 39, the code fails to work properly.";
- stage.scaleMode = StageScaleMode.NO_SCALE;
- tf.autoSize = TextFieldAutoSize.LEFT;
- tf.wordWrap = true;
- tf.multiline = true;
- tf.text = str;
- tf.width = 300;
- tf.height = 1;
- addChild(tf);
- var tfHeight:int;
- while (i >= MIN_SIZE) {
- tfm.size = i--;
- tf.setTextFormat(tfm);
- // the follwing line avoids the problem
- tf.height;
- tfHeight = tf.height;
- if (tfHeight < 300)
- break;
- }
- tf = new TextField();
- tf.width = 200;
- tf.text = "fontSize: " + i.toString() + " tf.height: " + tfHeight.toString();
- tf.x = 310;
- addChild(tf);
- }
- }
- }
notice:





