Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 3.2 (Release)
-
None
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
N/A its a line of code that needs fixing.
The problem is in this function :
override protected function hiliteSelectedNavItem(index:int):void
{
var child:Button;
// Un-hilite the current selection.
if (selectedIndex != -1 && selectedIndex < numChildren)
{
child = Button(getChildAt(selectedIndex));
child.enabled = true;
}
// Set new index.
super.selectedIndex = index;
// Hilite the new selection.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
child = Button(getChildAt(selectedIndex));
child.enabled = false;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
}
the highlighted 2 lines should be in a conditional as selectedIndex might be -1 and getchildat(-1) will break.
Solution:
replace these two lines with:
if (selectedIndex != -1)
{
child = Button(getChildAt(selectedIndex));
child.enabled = false;
}