(主帮助我在AS2编程)的ActionScript 2.0 - 匹配痕迹实际上并不匹配
我正在itterating通文本字段对象的数组和压片当跟踪被选定的关注领域,以及每个对象。
我试图将这些对象等同起来,但是当它们追踪完全相同时,它们不是。
m_InputFieldsArray = new Array(m_TitleTextInput, m_CommentsTextArea, m_EmailTextInput);
for (var i:Number = 0; i < m_InputFieldsArray.length; i++)
{
trace("Get Focus: " + Selection.getFocus());
trace("Arr Index: " + m_InputFieldsArray[i].textField);
if (Selection.getFocus() == m_InputFieldsArray[i].textField)
{
trace("Match!");
return;
}
else
{
trace("NO Match!");
}
}
输出:
Get Focus: _level0.m_Window.form.m_TitleTextInput.textField
Arr Index: _level0.m_Window.form.m_TitleTextInput.textField
NO Match!
Get Focus: _level0.m_Window.form.m_TitleTextInput.textField
Arr Index: _level0.m_Window.form.m_CommentsTextArea.textField
NO Match!
Get Focus: _level0.m_Window.form.m_TitleTextInput.textField
Arr Index: _level0.m_Window.form.m_EmailTextInput.textField
NO Match!
第一组轨迹相同,但显然它们不匹配。 Selection.getFocus()
返回一个字符串,而数组索引正在跟踪文本字段对象。如果我将toString()
添加到文本字段对象,它将跟踪为[Object object]
我该如何完成匹配?
'm_TitleTextInput'和其他组件? –
是的,他们是定制的Scaleform组件。 – TheDarkIn1978