[AS2] need help with actionscript reading how many images are in folder externally

Hello there,

I am in need of some help. I have successfully gotten my images to load externally and randomly into 4 different boxes on my stage.

My problem now is with the code I’m using, you HAVE to specify how many images there are in the actionscript. My goal is to allow for future updates to be done outside of flash and all we’d have to do is add or remove images in the external image folder.

Can anyone help enlighten my situation? Here’s the code I’m using:

var currBox:Number = new Number();
var contentWidth:Number = box_0.content._width;
 //Image loader
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
    with (target_mc) {
        if (_width>_height) {
            target_mc._xscale = target_mc._yscale=(contentWidth/target_mc._width)*100;
        } else {
            target_mc._xscale = target_mc._yscale=(contentWidth/target_mc._height)*100;
        _x = (_root["box_"+currBox]._width-_width)/2;
        _y = (_root["box_"+currBox]._height-_height)/2;
var image_mcl:MovieClipLoader = new MovieClipLoader();
//Array containing pictures
var amount:Number = 15
var pics:Array = new Array();
for (var i = 0; i<amount; i++) {
    pics* = "SplashImages/image"+i+".jpg";
//Keep only 4 images
while (pics.length>4) {
    pics.splice(random(pics.length), 1);
//Load each image randomly into one of the four boxes
if (pics.length<5) {
    for (var i = 0; i<4; i++) {
        var r:Number = random(pics.length);
        currBox = i;
        image_mcl.loadClip(pics[r], _root["box_"+i].content);
        pics.splice(r, 1);