Hi.
Sorry for the title, I can’t come up with a good one for my problem.
I’m having problems with some code i’m working on.
I’ll try to explain as good as I can.
I have a textinput that updates a textfiled on change.
I also have a textfield that shows how many chars you have typed.
on(change)
{
_root.test_txt.text = this.text;
_root.chars_txt.text = this.text.length;
}
What I want is that when (for example) the letter A is typed it counts it two times.
KIRUPA becomes 7 letters.
I was thinking of having something like numTest++
on(change)
{
myString = this.text;
for(var i:Number = 0; i < myString.length; i++)
{
if(myString.charAt(i) == "A")
{
numTest++
}
}
_root.chars_txt.text = this.text.length + numTest;
}
But I only want the thing to count the letter once. Now it adds numTest++ on the same letter when typing some more. ADDD becomes 8 chars. (Should be 5).
FLA can be downloaded here: http://www.lazeeonline.com/help.zip
Thnx in advance.