Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing the Selection color of a dynamic text field

328 views
Skip to first unread message

Vyshak V

unread,
Jan 30, 2008, 3:54:01 AM1/30/08
to
Hello all,

As one of the project requirements, I have to provide a functionality in my
application to be able to change the selection color of the text box. Having no
provision in Flash, I searched on the net and found one good example of doing
that with flash.geom.ColorTransform and TextFormat classes. It works fine with
windows. However, it doesn't work on Mac OSX. I am using Flash 8 with AS 2.0
for development.

Please refer the attached code

Please advice.
TIA

var my_txt:TextField = _root.createTextField("my_txt", 0, 10, 10, 250, 0);
my_txt._height = my_txt.getTextFormat().getTextExtent(" ").textFieldHeight;
my_txt.border = true;
my_txt.type = "input";

var color:Color = new Color(my_txt);
color.setTransform({rb:255, gb:0, bb:0});

rlc5611

unread,
Jan 30, 2008, 4:39:45 AM1/30/08
to
But what about?

my_txt.background = true;
my_txt.backgroundColor = 0xFF0000;

Vyshak V

unread,
Jan 30, 2008, 4:45:41 AM1/30/08
to
I want to change the selection color, not the entire background color of the
textfield. just to give an example, am building a text to speech application
where as the speech continues, we will select the particular word with a red
selection color.

GWD

unread,
Jan 30, 2008, 7:10:57 AM1/30/08
to
This does something similar with bitmapData for entire lines of text:

http://www.quasimondo.com/archives/000620.php

If I were you I would investigate adapting that approach to isolate words.
(Maybe it's been done somewhere already, might pay to search first)

GWD

unread,
Jan 30, 2008, 7:21:58 AM1/30/08
to
Actually I think there's a simpler as3 approach described here that could be backported to as2.
http://labs.hellokeita.com/2007/11/

Vyshak V

unread,
Jan 30, 2008, 7:33:41 AM1/30/08
to
Got It!..

Flash player version problem...I upgraded to Adobe Flash Player 9 Update 3, version number 9.0.115.0 on Mac FF2 and the color transform is working perfect!


0 new messages