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

    Error 2025 and getting children with an ItemRenderer

      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) {

      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();

      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?