3 Replies Latest reply on Feb 24, 2009 6:09 PM by Newsgroup_User

    ResourceManager with removed child of View Stack

      Hi all,

      I have a problem and don't know how to sort it out. Please help me.
      Here is the case:
      I have a View Stack which contains 4 children components. At the design time, i put those 4 components into the View Stack and their captions are set by using ResourceManager. But at runtime i just one 2 of them are visible. So from onShow function, I call removeChild() function to remove 2 of them. But when I change the language at runtime, I got the error like this:


      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller. at flash.display::DisplayObjectContainer/getChildIndex() at mx.core::Container/getChildIndex()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core \Container.as:2400] at mx.controls::NavBar/labelChangedHandler()[E:\dev\3.1.0\frameworks\projects\framework\src\ mx\controls\NavBar.as:1154] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\co re\UIComponent.as:9156] at mx.core::Container/set label()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core\Container.as:1494]

      I think when change language event fired, the View Stack will dispatcher the event to every its child. And in my case, 2 of them have been removed. And this will cause the error.
      Could anyone help me to solve my problem?
      Thank in advance