문제

Im creating a simple program that will compare user input to a predetermined string (for memorization help). So far, after the user pushes space a code will run to break the user input text into individual characters (in an array) to test it against the original.

When the user pushes space and one of the letters is wrong, I want that letter to turn a different color. Is there any way to store htmlText in an array, or can anyone think of a way to make that letter turn the color?

Is there any way to write the program at all? Am I able to keep the text in a string and compare it (the spaces and punctuation need to be ignored)?

도움이 되었습니까?

해결책

You can change color without htmlText.

Use setTextFormat.

example:

var format:TextFormat = textField.getTextFormat(wrongLetterBeginIndex, wrongLetterEndIndex);
format.color = 0xFF0000;
textField.setTextFormat(format, wrongLetterBeginIndex, wrongLetterEndIndex);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top