Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 在数组中存储htmlText_Arrays_Actionscript 3_Htmltext - Fatal编程技术网

Arrays 在数组中存储htmlText

Arrays 在数组中存储htmlText,arrays,actionscript-3,htmltext,Arrays,Actionscript 3,Htmltext,我正在创建一个简单的程序,将用户输入与预定字符串进行比较(用于记忆帮助)。到目前为止,在用户按下空格后,将运行一个代码,将用户输入的文本拆分为单个字符(在数组中),以对照原始文本进行测试 当用户按下空格键,其中一个字母出现错误时,我希望该字母变成不同的颜色。有没有办法将htmlText存储在数组中,或者有人能想出一种方法使该字母变色 有没有办法写这个程序?我是否能够将文本保存在字符串中并进行比较(空格和标点符号需要忽略)?您可以在不使用htmlText的情况下更改颜色 使用setTextForm

我正在创建一个简单的程序,将用户输入与预定字符串进行比较(用于记忆帮助)。到目前为止,在用户按下空格后,将运行一个代码,将用户输入的文本拆分为单个字符(在数组中),以对照原始文本进行测试

当用户按下空格键,其中一个字母出现错误时,我希望该字母变成不同的颜色。有没有办法将htmlText存储在数组中,或者有人能想出一种方法使该字母变色


有没有办法写这个程序?我是否能够将文本保存在字符串中并进行比较(空格和标点符号需要忽略)?

您可以在不使用htmlText的情况下更改颜色

使用setTextFormat

例如:

var format:TextFormat = textField.getTextFormat(wrongLetterBeginIndex, wrongLetterEndIndex);
format.color = 0xFF0000;
textField.setTextFormat(format, wrongLetterBeginIndex, wrongLetterEndIndex);