5 Replies Latest reply on Apr 30, 2013 12:26 AM by LevkoYaskewych

    List Item Renderers, State Changes, and Error #2025

    Anm_LA Level 1
      I keep getting the following error on apps that have lists with custom item renderers and state changes:

      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/removeChild()
      at mx.core::UIComponent/ http://www.adobe.com/2006/flex/mx/internal::$removeChild()
      at mx.core::UIComponent/removeChild()
      at mx.controls::SWFLoader/load()
      at mx.controls::SWFLoader/mx.controls:SWFLoader::commitProperties()
      at mx.core::UIComponent/validateProperties()
      at mx.managers::LayoutManager/validateClient()
      at mx.controls::List/mx.controls:List::makeRowsAndColumns()
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::updateDisplayList()
      at mx.controls::List/mx.controls:List::updateDisplayList()
      at mx.core::UIComponent/validateDisplayList()
      at mx.managers::LayoutManager/::validateDisplayList()
      at mx.managers::LayoutManager/::doPhasedInstantiation()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/::callLaterDispatcher2()
      at mx.core::UIComponent/::callLaterDispatcher()

      Here is an example:
      It contains a List with custom ItemRenderer inside a particular state view, and a button to change state. This error does not seem to appear without changing state.

      You can generate the error by following these steps:
      Change State
      Change State // Note the bitmap doesn't renderer
      Remove All
      Add // crash

      I have also seen the error on "Remove" and "Change State", but I can't come up with a reliable series of steps.

      Can anyone point out what I did wrong, or at least how I can avoid this error?
        • 1. Re: List Item Renderers, State Changes, and Error #2025
          supertimvanderh Level 1
          strange. Found out that it also occurs without changing state. I mean, starting from scratch randomly adding and removing states will result in a render error, after that add will result in the same error. Have you tried this without states?
          • 2. Re: List Item Renderers, State Changes, and Error #2025
            Anm_LA Level 1
            Okay. Yes. It does occur without a state change:
            Select 2nd
            Select 2nd (was 3rd)
            Add // Crash

            With that in mind, here is the list specific code:

            <mx:List id="char_list" editable="false"
            left="10" top="10" bottom="70" right="10"

            // . . .
            public var characters:ArrayCollection = new ArrayCollection();

            public function add() :void {
            new Character( "Character Name", new Portrait(), "Location", "Server" )

            public function remove() :void {
            var selected :Array = char_list.selectedItems;
            for each( var character :Object in selected ) {
            var index :int = characters.getItemIndex( character );
            characters.removeItemAt( index );

            public function removeAll() :void {


            <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml"
            width="300" height="118">
            <mx:Image id="portrait" width="100" height="100" source="{data.Icon}" verticalCenter="0" left="8"/>
            <mx:VBox left="116" right="5" top="5" bottom="5" verticalGap="0">
            <mx:Text text="{data.FullName}" width="100%" fontWeight="bold" fontSize="14"/>
            <mx:Text text="{data.Location}" width="100%"/>
            <mx:Text text="{data.Server}" width="100%"/>


            // all the following have matching getters, without the underscore
            private var _name :String;
            private var _icon :Bitmap;
            private var _location :String;
            private var _server :String;

            • 3. Re: List Item Renderers, State Changes, and Error #2025
              Anm_LA Level 1
              I just realized the Character getter functions and inner private variables aren't exact matches, so here is the getter code:


              public function get FullName() :String { return _name; }
              public function get Icon() :Bitmap { return _icon; }
              public function get Location() :String { return _location; }
              public function get Server() :String { return _server; }

              • 4. Re: List Item Renderers, State Changes, and Error #2025
                Anm_LA Level 1
                Still hoping for an answer. Does anyone have a clue about the above error?
                • 5. Re: List Item Renderers, State Changes, and Error #2025
                  LevkoYaskewych Level 1

                  When building a list on iOS, if you are using an image for instance in the overskin, the garbage collection fails while the list is moved rapidly. It CANNOT addChild and removeChild fast enough. You then get a 2025 error.

                  It will still run on a device but will lock up on rapid scroll making parts of the list fail to generate.

                  Drag scroll uses an image background to get the effect.


                  The screen cannot dispose of the images and replace them to avoid overload of the memory if using large lists.


                  Try using a stock standard list or grid without any changes to the look and feel.


                  It should work. As for formatting the cells ...


                  I am sure that Adobe will look into this in FLASH. They need to look at the cellrenderer overskin in the library and allow the overskin to be made available to format change just like every other element in the library.  THIS IS A BUG.