开发者

TextField Caret Does Not Display in Actionscript 3

开发者 https://www.devze.com 2022-12-14 08:46 出处:网络
I am trying to display a text field that has text inside it, and display the flashing Caret at the end of the text.

I am trying to display a text field that has text inside it, and display the flashing Caret at the end of the text. I have tried the following:

Code:

// ti_title is my textField

stage.focus = ti_title;

ti_title.setSelection( ti_title.length, ti_title.length );

I have also tried:

// ti_title is my textField

ti_title.stage.focus = ti_title;开发者_StackOverflow中文版

ti_title.setSelection( ti_title.length, ti_title.length );

The field is focused because I can type into it, but I do not see a Caret until I have started typing. This is not very good for usability.

I have even tried removing text then re-adding it and then setting the selection again, but still not working. Any ideas?


I figured out what I was doing wrong.

The orginal Textfield on the stage had a Font color of white. I changed the font color to Black and the caret appeared. It was just being hidden against the white background.

This code:

ti_title.stage.focus = ti_title;

ti_title.setSelection( ti_title.length , ti_title.length);

worked in displaying the caret.

0

精彩评论

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

关注公众号