Change TextField selection color in AS3

懵懂的女人 提交于 2019-12-03 14:00:28

问题


How can I change the select ("highlight") color of an TextField in actionscript 3? I've got an input textfield with white text on a black backdrop and as a result, selections are invisible, which is horrible for usability. Thanks!


回答1:


Try this:

var c:Color = new Color(MyTextField);

c.setTransform({rb:255});

or for a more up to date approach:

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/geom/ColorTransform.html#includeExamplesSummary




回答2:


Another approach is to use the Text Layout Framework, specifically a TextFlow using a SelectionManager. With the TLF, you can directly control the SelectionFormat properties used for your text.

e.g.

TextFlow.defaultConfiguration.focusedSelectionFormat = new SelectionFormat(0x00FFFF);

There's a bit of a learning curve to pick up the TLF's way of doing things, but the payoff is significantly enhanced text customization.




回答3:


Here you can find a class doing the job

http://labs.hellokeita.com/2008/03/13/textfield-selection-color/

Reference site is down with its class :(

Here you can find something similar, although not so powerful: http://yourpalmark.com/2007/08/13/changing-selection-color-on-dynamic-textfields/



来源:https://stackoverflow.com/questions/2072401/change-textfield-selection-color-in-as3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!