Array.problem

Hi,

I am having problems with loading a range of movieClips into an itemQueue_mc

 I have 7 mc's with
linkage id's in the library

Once a random clip has been attached and run it's cause, the clip gets
removed from the array when the attachRandom function is triggered again.

The attachRandom function does all of this.

The problem is that not all of the clips are getting loaded in when the
attachRandom function gets called, sometimes it stops after 3, sometimes it
won't load any.

I may be missing something real obvious.

Can anyone help me with this. I can send the .fla with an exhaustive
explanation on how the clips work.

Thanks

[AS]
 //create array to store references to the clip id's
categories = new Array();.

categories[0] = [‘accessories_mc’];
categories[1] = [‘work_mc’];
categories[2] = [‘holiday_mc’];
categories[3] = [‘gym_mc’];
categories[4] = [‘partyTime_mc’];
categories[5] = [‘partyWear_mc’];
categories[6] = [‘comfyCasual_mc’];

//attachRandom() function that attaches clips to the itemQueue_mc
function attachRandom(){
var catLength = categories.length;
if(catLength == 0){
_root.gotoAndPlay(“endGame”);
doSomeStuff;

       }else{
               // let's make a random selection of the category:
                var cat = Math.round(Math.random()*(catLength-1));

// attach this item to the queue_mc. by loading always into the same //depth (1), the item which was there previously gets obliterated
_root.itemQueue_mc.attachMovie(categories[cat],‘curItem’,1);

               //as every category should only appear once, let's remove this category
               //from the array:
                categories.splice(cat,1);
       }

}
[/AS]