开发者

tlf text field align right problem

i have a tlf text field created with action script. when i add a

format.align = TextFormatAlign.RIGHT;

the area of tlftextfield that not have text not get selected, you have to click on the text to get foucs.

example link: http://aradon.co.il/test/tlf.html

here is the code:

   import fl.text.TLFTextField;
   import flash.text.TextFormat;
   import flash.text.TextFormatAlign;

   var format:TextFormat = new TextFormat("Tahoma", 13, 0x0);
   format.align = TextFormatAlign.RIGHT;

   var _valueField:TLFTextField = new TLFTextField();
 开发者_C百科  _valueField.width = 200;
   _valueField.height = 22;

   _valueField.x = 20;
   _valueField.y = 20;
   _valueField.wordWrap = true;
   _valueField.multiline = false;
   _valueField.type = TextFieldType.INPUT;
   _valueField.defaultTextFormat = format;

   _valueField.background = true;
   _valueField.backgroundColor = 0xc6c6c6;

   _valueField.setTextFormat( format );

   addChild(_valueField);


   _valueField.text = "text";


I've had this same problem. My fix is posted over here:
https://github.com/alexdeefuse/TLFTextField-fix

I tested it only on single line TLFTextFields.

If you take a look at the fix, what I'm doing is go down the display list of the TLFTextField and correct the position of the SimpleButton inside there. (the button is responsible for the user input and TLF's extend DisplayObjectContainers).


a workaround for your problem is to define a border for the textinput:

_valueField.border = true;
_valueField.borderColor = 0xc6c6c6;

This looks a bit buggy behavior with the tlf, when testing in flash ide (adding the textfield with the text tool) I can't reproduce the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜