Hi,
I’ve been developing a piece of code that looks for keywords inbetween tags, and then stores these into an array (hlword) I am now trying to get it so that when it finds these words, it makes the word bold and changes the colour.
[FONT=Courier New]var origString:String = content_txt.text;[/FONT]
[FONT=Courier New] var inChar1 = “–!”; //wraps around hyperlink
var inChar2 = “!–”;
var hlword = new Array(); //define variables
var tempword = “”;
var outString = “”;
var newString = origString.split(inChar1); //split the string
//trace(newString);
for(i = 0; i < newString.length -1; i++) // get the hyperlink words
{
tempword = newString[i+1].split(inChar2);
hlword.push(tempword[0]);
trace(hlword);[/FONT]
[FONT=Courier New] }
[COLOR=darkorange]for(chr in hlword){[/COLOR][/FONT]
[FONT=Courier New][COLOR=darkorange]var format:TextFormat = new TextFormat();
format.color = 0x8DC0E4;
format.bold = true;
hlword.text.setTextFormat(format);
}[/COLOR][/FONT]
The code in orange is what I have been working on in an attempt for it to change the Textformat - Is this going a long the right lines?
Any advice would be great thanks!