Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 184925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:22:43+00:00 2026-05-11T15:22:43+00:00

How do I remove an items from a data bound array? My code follows.

  • 0

How do I remove an items from a data bound array? My code follows.

for(var i = 0; i < listBox.selectedIndices.length; i++) {   var toRemove = listFiles.selectedIndices[i];   dataArray.splice(toRemove, 1); } 

Thanks in advance!

Edit Here is my swf. The Add Photos works except when you remove items. http://www.3rdshooter.com/Content/Flash/PhotoUploader.html

  1. Add 3 photos different.
  2. Remove 2nd photo.
  3. Add a different photo.
  4. SWF adds the 2nd photo to the end.

Any ideas on why it would be doing this?

Edit 2 Here is my 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 > 0); }  private function OnButtonRemoveClicked(e:Event):void {     for(var i:Number = 0; i < 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 > 0);     buttonUpload.enabled = (arrayQueue.length > 0); } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:22:44+00:00Added an answer on May 11, 2026 at 3:22 pm

    It would definitely be helpful to know two things:

    1. Which version of ActionScript are you targeting?

    2. Judging from the behavior of your application, the error isn’t occurring when the user removes an item from the list of files to upload. Looks more like an issue with your logic when a user adds a new item to the list. Any chance you could post that code as well?

    UPDATE:

    Instead of: arrayQueue[arrayQueue.length]=lid

    Try: arrayQueue.push(lid)

    That will add a new item to the end of the array and push the item in to that spot.

    UPDATE 2:

    Ok, did a little more digging. Turns out that the fileList doesn’t get cleared every time the dialog is opened (if you’re not creating a new instance of the FileReferenceList each time the user selects new files). You need to call splice() on the fileList after you add each file to your Array.

    Try something like this in your AddFile() method…

    for(var j:int=0; j < fileRefList.fileList.length; j++) {      arrayQueue.push(fileRefList.fileList[j]);      fileRefList.fileList.splice(j, 1); } 

    That will keep the fileList up to date rather than holding on to previous selections.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Right-click on the project, select 'Export...', then choose web ->… May 11, 2026 at 11:45 pm
  • Editorial Team
    Editorial Team added an answer The problem is double-decoding. XML::RAI::parse_string() apparently expects an UTF-8 encoded… May 11, 2026 at 11:45 pm
  • Editorial Team
    Editorial Team added an answer I've thrown together a quick jQuery plugin (function($){ $.fn.newWindow =… May 11, 2026 at 11:45 pm

Related Questions

Following from my question on binding in general , I'd like to ask for
I have a ComboBox in WPF which is databound, and has data template which
I am looking for a way to quickly compare the state of a database
I would like to create a visual effect when an item in a listbox

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.