0 Replies Latest reply on Aug 2, 2007 8:10 AM by Handycam

    Cannot delete child on change state!

    Handycam Level 1
      OK, I've go an app with two states. The base state has a panel, app control bar, and a viewstack. The second state should delte all of those and add a title window.

      I created the second state,use AddChild to add the title window and removeChild to remove the IDs of the above items. I set a button to click="this.currentState='second'". I get this error:

      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at mx.core::Container/removeChild()
      at mx.states::RemoveChild/apply()
      at mx.core::UIComponent/private::applyState()
      at mx.core::UIComponent/private::commitCurrentState()
      at mx.core::UIComponent/setCurrentState()
      at mx.core::UIComponent/set currentState()
      at cyor1/___cyor1_Button1_click()
      at [mouseEvent]

      OK, I wrapped the whole first screen in a canvas, and then use only one removeChild to remove the canvas. This works, but then my App Control Bar is not docked. So I try moving the app control bar out of the canvas and adding its ID as a remove child. The error happens again!!

      I have even tried adding removeChilds for the app control bar and its child linkbar, same thing.

      What's going on here?