title: Removing items from data bound array
body: <p>How do I remove an items from a data bound array? My code follows.</p>
  
  <pre><code>for(var i = 0; i &lt; listBox.selectedIndices.length; i++) {
    var toRemove = listFiles.selectedIndices[i];
    dataArray.splice(toRemove, 1);
  }
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Edit</strong> Here is my swf. The Add Photos works except when you remove items.
  <a href="http://www.3rdshooter.com/Content/Flash/PhotoUploader.html" rel="nofollow noreferrer">http://www.3rdshooter.com/Content/Flash/PhotoUploader.html</a></p>
  
  <ol>
  <li>Add 3 photos different.</li>
  <li>Remove 2nd photo.</li>
  <li>Add a different photo.</li>
  <li>SWF adds the 2nd photo to the end.</li>
  </ol>
  
  <p>Any ideas on why it would be doing this?</p>
  
  <p><strong>Edit 2</strong> Here is my code</p>
  
  <pre><code>private function OnSelectFileRefList(e:Event):void
  {
      Alert.show('addstart:' + arrayQueue.length);
      for each (var f:FileReference in fileRefList.fileList)
      {
           var lid:ListItemData = new ListItemData();
           lid.fileRef = f;
           arrayQueue[arrayQueue.length]=lid;
      }
      Alert.show('addcomplete:' + arrayQueue.length);
      listFiles.executeBindings();
      Alert.show(ListItemData(arrayQueue[arrayQueue.length-1]).fileRef.name);
      PushStatus('Added ' + fileRefList.fileList.length.toString() + ' photo(s) to queue!');
      fileRefList.fileList.length = 0;
      buttonUpload.enabled = (arrayQueue.length &gt; 0);
  }
  
  private function OnButtonRemoveClicked(e:Event):void
  {
      for(var i:Number = 0; i &lt; listFiles.selectedIndices.length; i++) {
          var toRemove:Number = listFiles.selectedIndices[i];
          //Alert.show(toRemove.toString());
          arrayQueue.splice(toRemove, 1);
      }
      listFiles.executeBindings();
      Alert.show('removecomplete:' + arrayQueue.length);
      PushStatus('Removed photos from queue.');
      buttonRemove.enabled = (listFiles.selectedItems.length &gt; 0);
      buttonUpload.enabled = (arrayQueue.length &gt; 0);
  }
  </code></pre>