Hey Ktt,
I found this, but it is AS2 I think. You might be able to convert to AS3 if you really need to.

var format1_fmt:TextFormat = new TextFormat();
format1_fmt.font = "Arial";
var format2_fmt:TextFormat = new TextFormat();
format2_fmt.font = "Courier";
format2_fmt.color = 0xFF0000;
format2_fmt.bold = true;
this.createTextField("my_txt", this.getNextHighestDepth(), 0, 0, 300, 200);
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.setTextFormat(0, firstIndex, format1_fmt);
my_txt.text = "hallo this is a test made by Xeef from As.Org";
var secondIndex:Number = my_txt.length;
my_txt.setTextFormat(format1_fmt);
SearcFor = "Xeef";
q = my_txt.text.indexOf(SearcFor);
if (!(q+1)) {
    trace("string NOT found");
} else {
    my_txt.setTextFormat(q, q+SearcFor.length, format2_fmt);
}

Here is the thread if you want to read up.
http://www.bigresource.com/Tracker/Track-flash-dJD6qTTW2R/
Hope that is what you needed or at least get you going down the home stretch.

Best,

Karl


On Aug 16, 2010, at 1:35 AM, ktt wrote:

Thank you for reply. I use setTextFormat, but the parsing of textfield's
lines content is quite tricky. I can extract text with getLineText,
but having problems accesing a word's indexOf.

Regrds,
Ktt

--- On Mon, 8/16/10, Henrik Andersson <[email protected]> wrote:

From: Henrik Andersson <[email protected]>
Subject: Re: [Flashcoders] Highligting words in a textField
To: "Flash Coders List" <[email protected]>
Date: Monday, August 16, 2010, 2:11 AM
ktt wrote:
How is it possible to higlight some words in a
textFiled which is splited to lines (\n) ?

I would use the setTextFormat method if I had to use a
TextField. But I would rather use flash.text.engine and
assign a separate content element instead.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to