dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] Filter an Array

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jun 2004
    Posts
    7

    [F8] Filter an Array

    I have an array that looks like this:
    100_0061.JPG,100_0064.JPG,100_0068.JPG,100_0069.JP G,test.swf,test.fla

    and the code that is building it:
    //jpgs to load
    basePath = mdm.Application.path + "presFiles/"
    var myFiles:Array = mdm.FileSystem.getFileList(basePath, "*.*");
    numberOfFiles = myFiles.length

    How can I remove the swf and fla files and update the length of the array.

    Thanks in advance!

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Depends on what you're trying to do.
    If you know that what you want to do is removing the last two elements of the array, just use my_array.splice(-2);:
    code:

    var my_array:Array = new Array("100_0061.JPG", "100_0064.JPG", "100_0068.JPG", "100_0069.JPG", "test.swf", "test.fla");
    my_array.splice(-2);
    trace (my_array);



    If you want to remove the indexes that contain ".fla" and ".swf", you'll have to search the array for these and remove the indexes you found.

  3. #3
    Junior Member
    Join Date
    Jun 2004
    Posts
    7
    The array will change (based on files they drop in a folder, using ZINC for this) I guess I would need to know how to search the array and create a new one. I really appreciate your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center