1 Reply Latest reply on Jul 3, 2007 2:05 PM by ntsiii

    Error 2025 and getting children with an ItemRenderer

    big4head Level 1
      Trying to determine whether to add another custom component item to a List (using an itemRenderer) depending on whether the list component clicked is in the last position

      Code in the component
      private function addPanel(event:Event):void {
      if (event.target.selected) {
      this.parentApplication.addASWB(this);
      }
      }

      Code in the app:
      public function addASWB(aswb:ASWBox):void
      {
      var idx:int = getIdx(aswb as DisplayObject);
      if (idx == (targetData.length-1)) {
      var aswb2:ASWBox = new ASWBox();
      targetData.push(aswb2);
      cmp.dataProvider.refresh();
      }
      }

      public function getIdx(item:DisplayObject):int
      {
      return cmp.getChildIndex(item);
      }


      I get the following error:
      #2025: The supplied DisplayObject must be a child of the caller.

      Is this an issue with using an itemRenderer for a list? Can positions and indexes not be accessed because of it or do I have a flawed understanding of Lists, data Providers and ItemRnderers?