Archive for March, 2008

TextField Selection Color

Well, I just made a class to change the textField selection color.
It manipulates the ColorMatrixFilter to change the colors of the unselected text, selection background and selected text.

The source is in my SVN, http://code.hellokeita.in/public/trunk/as3/br/hellokeita/utils/TextFieldColor.as

And the usage is really simple too.

[code lang="actionscript"]

var textColor:uint = 0xff0000; // unselected text color
var selectionColor:uint = 0x00ff00; // selected background color
var selectedColor:uint = 0x0000ff; // selected text color

var tf:TextField = new TextField();

addChild(tf);

var tfc:TextFieldColor = new TextFieldColor(tf, textColor, selectionColor, selectedColor);

//...
// Or Also
//...

tfc.textColor = textColor;
tfc.selectionColor = selectionColor;
tfc.selectedColor = selectedColor;

[/code]

Vote in HexoSearch Vote

Comments (10)