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.
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);
Actually, I didn’t show the source because I wanted to know how many people was reading it, and was interested about it… so let me reveal the little trick.
First, I create a TextField, selectable(obviously) and set the alpha to zero.
Than, create a BitmapData with the TextField size, and, just draw the TextField on BitmapData each time the selection changes.
When you draw the BitmapData, there is to ways to change the selection color, using the ColorTransform or PalleteMap methods.
After that, you just place the Bitmap behind the textField.
[code lang="actionscript"]
var color = 0xff0000;
var c = ColorUtils.getRGB(color);
One thing is that, using Color transform, you can change easily the smoothed fonts, and with PalleteMap is harder.
Just remember that the selection color is always black, so you need to change the black part of the BitmapData to any color you want.
Easy huh?
PS: weird thing is that some people couldn’t see the effect on Mac with Firefox… I didn’t try it yet, but I’ll try to find a way to make it work.