0

When I add a tooltip and then remove the tool tip I get the following error when I click on the stage:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/getChildIndex()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::rawChildren_getChildIndex()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\SystemManager.as:2195]
    at mx.managers::SystemChildrenList/removeChild()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\SystemChildrenList.as:167]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::reset()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\ToolTipManagerImpl.as:1379]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::targetChanged()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\ToolTipManagerImpl.as:892]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::checkIfTargetChanged()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\ToolTipManagerImpl.as:797]
    at mx.managers::ToolTipManagerImpl/http://www.adobe.com/2006/flex/mx/internal::toolTipMouseOverHandler()[C:\Jenkins\workspace\flex-sdk_release-candidate\frameworks\projects\framework\src\mx\managers\ToolTipManagerImpl.as:1623]

I've tried everything I know to get rid of it. Here is the code I'm using:

// adding
PopUpManager.addPopUp(rulerPopUp, SystemManager.getSWFRoot(this));
toolTipPopUp = ToolTipManager.createToolTip("HELLO", event.stageX, event.stageY) as ToolTip;
ToolTipManager.currentToolTip = toolTipPopUp;

swfRoot.addEventListener(MouseEvent.MOUSE_MOVE, mouseRulerMoveHandler, true, EventPriority.CURSOR_MANAGEMENT, true);
swfRoot.addEventListener(MouseEvent.MOUSE_UP, mouseRulerUpHandler, true, EventPriority.CURSOR_MANAGEMENT, true);

// removing
swfRoot.removeEventListener(MouseEvent.MOUSE_MOVE, mouseRulerMoveHandler, true);
swfRoot.removeEventListener(MouseEvent.MOUSE_UP, mouseRulerUpHandler, true);

if (toolTipPopUp && toolTipPopUp.stage) {
    ToolTipManager.destroyToolTip(toolTipPopUp);
    toolTipPopUp = null;
}

Can anyone see the reason why I'm getting this error?

ketan
  • 19,129
  • 42
  • 60
  • 98
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231

1 Answers1

0

It appears setting the currentToolTip to null fixes the issue.

if (toolTipPopUp && toolTipPopUp.stage) { ToolTipManager.destroyToolTip(toolTipPopUp); ToolTipManager.currentToolTip = null; // added this line toolTipPopUp = null; }

I haven't had any errors occur since.

1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231