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.

var textColor:uint = 0xff0000; // unselected text color
var selectionColor:uint = 0×00ff00; // selected background color
var selectedColor:uint = 0×0000ff; // 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;

1 Comment »

  1. Og2t said,

    June 25, 2008 @ 6:39 pm

    Very nice. Would that be possible to use it with HTML textfield, i.e. different colour text?

RSS feed for comments on this post · TrackBack URI

Leave a Comment