(主幫助我在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