Help with changing letter colour in a string

Hi,

I’m having big trouble figuring out how to code the following.

At the moment I have a textfield dynamically appearing on screen. The string in this textfield contains the following ‘jjj fff jjj fff’.

I then created a listener. So that everytime a user presses a key, the key is compared to the first letter in the string, and when they press a second key it is compared to the second letter in the string and so on. The comparison tells you whether the user has pressed the same key or if the keys are different.

What i want to do is proving somewhat impossible for me!

If the key that the user pressed is not the same as the letter in the textfield I want that letter in the string to change colour (go red), so the user knows they typed in the wrong letter. I also want the key that they pressed to be voided out so that they will once again have to retype the (red) letter in the string again. The problem seems to be setting the colour of just a letter in a textfield. I have this code here:

myTextField.html = true;
myTextField.htmlText = ‘<font color="#DD0000">j</font><font color="#00DD00">j</font><font color="#00DD00">j</font>…etc.’
but don’t exactly know how i am to use this to change the colour of just one letter, because this seems to create another string which i dont want to do

Any help would be appreciated as I’ve bin stuck on this problem for a few days now.

Cheers
Clo