0 Replies Latest reply on Mar 17, 2007 3:15 AM by r08

    List bounds issue

    r08
      I have a custom component of type List with a item renderer of type Vbox which holds a label and an image. The image is drag enabled, on drag it can be dropped into a canvas. On the drop event im calling a method to remove the remaining information from the list. However the information stays and i get a supplied index is out of bounds.

      Any ideas?

      code is as follows:

      // data creation
      arrCAWModules = new ArrayCollection(arrModules); <-- xml import

      //create custom component
      <v:ArtworkModules id="awModuleView" artModules="{arrCAWModules}"/>

      //custom component
      <mx:List xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="200"
      height="100%"
      dataProvider="{artModules}"
      itemRenderer="views.leftHandColumn.TextAndPic" >

      <mx:Script>
      <![CDATA[
      import mx.controls.Image;
      import mx.collections.ArrayCollection;

      [Bindable]
      public var artModules:ArrayCollection;


      ]]>
      </mx:Script>

      </mx:List>

      // label and image
      <mx:Label text="{data.label}" width="100%"/>
      <mx:Image id="awImage" source="{data.iconImage}"
      width="100%"
      height="100%"
      mouseDown="dragIt(awImage,event,'moduleFormat')"/>
      </mx:VBox>


      // main application mxml
      public function removeFromList(img:Image):void{
      var imgSourceName:String = String(img.source.toString());
      for(var i:uint = 0; i < arrCAWModules.length;i++){
      if(arrCAWModules.getItemAt(i).getImageName == imgSourceName){
      arrCAWModules.removeItemAt(i);
      awModuleView.removeChildAt(i);
      }
      }
      }