Question

I'm developing an application with TitleWindows that are created using the PopUpManager so they can be dragged. Buttons on a ButtonBar display them. After some testing, I found out that the error below is triggered when I am displaying the TitleWindow for the third time (not first or second, but only third) and I try to retrieve the ToolTip from either the Button on the ButtonBar or the TabNavigator in the TitleWindow (by hovering the mouse over these components).

RangeError: Error #2006: The supplied index is out of bounds.
    at flash.display::DisplayObjectContainer/addChildAt()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()
    at mx.managers::SystemChildrenList/addChild()
    at mx.managers::SystemManager/addChildToSandboxRoot()
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::createTip()
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::showTimer_timerHandler()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

Also, when I try clicking the Button to display the TitleWindow for the fourth time and I'm faster than the ToolTip to avoid the error, I get this error:

RangeError: Error #2006: The supplied index is out of bounds.
    at flash.display::DisplayObjectContainer/addChildAt()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_addChildAt()
    at mx.managers::SystemManager/addChild()
    at mx.managers::PopUpManagerImpl/addPopUp()
    at mx.managers::PopUpManager$/addPopUp()
    at assets.components::FloatingWindow/show()
    at MethodInfo-1879()

I have a FloatingWindow class (attached) which extends TitleWindow, and then I'm creating a new class called SearchWindow which extends the FloatingWindow. The ButtonBar is in a class that extends HBox. The ButtonBar has the following function to display the SearchWindow:

function searchButton_click(event:MouseEvent):void
            {
                //Show Search Window
                if (searchWindow.removed == true)
                {
                    searchWindow.map = _map;
                    searchWindow.webService = wsGetData;
                    searchWindow.show(30);
                }

            }

The pattern of this error is strange. Why just on the 3rd time do I get the error with the ToolTip and 4th time with the Poping up the TitleWindow? Could part of the problem be my leap-frogging of classes? I have a custom ButtonBar class, where the SearchWindow is created, which is a custom class based off another custom class (FloatingWindow), which is based off TitleWindow. Can this be the cause of the problem?

Any help is greatly appreciated.

Was it helpful?

Solution

Look for memory leaks. Maybe your window is not removed from memory and TooltipManager keeps reference to previously opened instance. Ist's a blind shot.

OTHER TIPS

Maybe your searchwindow hasn't been created yet. Try this:

function searchButton_click(event:MouseEvent):void
{
    //Show Search Window
    if (searchWindow && searchWindow.removed)
    {
        searchWindow.map = _map;
        searchWindow.webService = wsGetData;
        searchWindow.show(30);
    }
}

This should at least stop the errors from happening.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top