# Control contents of a randomly chosen folder

**URL:** <https://forum.kirupa.com/t/control-contents-of-a-randomly-chosen-folder/107484>\
**Category:** Uncategorized\
**Created:** [April 15, 2004, 8:05pm UTC](https://forum.kirupa.com/t/control-contents-of-a-randomly-chosen-folder/107484 "2004-04-15T20:05:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LEL](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@LEL](https://forum.kirupa.com/u/LEL)\
**Post date:** [April 15, 2004, 8:05pm UTC](https://forum.kirupa.com/t/control-contents-of-a-randomly-chosen-folder/107484/1 "2004-04-15T20:05:49Z")

</div>

Hi,

I’m developing a Hi Lo game.

The user has to guess the values of 7 categories, sportswear, jeans, shoes etc…

I have 7category folders in the library each with 10 item\_mc’s (with linkage id’s as well). The system I’m working on needs to be able to randomly select 1 of the folders and load the contents into a host\_mc that is positioned off stage. These will be the items that the user has to guess Hi or Lo for.

I then need to control these clips and move them around the stage.

I need help in controlling the clips…

some code…i’m testing initially with 3 folders and 3 items in each!

//move function that moves the clip around the game area  
MovieClip.prototype.moveMe = function(targetX, targetY, acc){

this.onEnterFrame = function(){  
this.\_x += (targetX-this.\_x) / acc;  
this.\_y += (targetY-this.\_y) / acc;  
}  
}

//Create an array of names of the MC groups. You have to have 3 groups. And 3 MC in every group.  
var clips\_name = [“shoes”,“trousers”,“jumpers”];  
//create an array to keep track of items that have already been loaded in.  
var itemsPlayed = new Array();  
//Function for attaching MCs  
function loadItemQueue(){  
//Randomly pic up one out 3 groups  
var n = random(clips\_name.length);  
var name = clips\_name[n];  
trace(name)  
for(i = 0; i\<2; i++){  
itemQueue\_mc.attachMovie(name+i,“name”+i,i);  
\_root.itemQueue\_mc[“name”+i].\_x = 70\*i;  
\_root.itemQueue\_mc[“name”+i].id = i;  
//\_root.itemQueue\_mc[“name”+i].txt = name + i;  
}  
queueLoaded();  
movefirstTwo();

}

//function to move first two clips into posotion  
function movefirstTwo(){  
for(i = 0; i\<clips\_name.length; i++){  
\_root.itemQueue\_mc[“name”+i].moveMe(10, 10, 10);  
}  
}  
//

//gets called when the items have loaded  
function queueLoaded(){  
trace(“I’m inside the item Array!”);  
}

function queueEmpty(){  
trace(“I’m empty!”);  
}

I add this button event to start it…

on(release){  
loadItemQueue();  
}

the last 3 functions are to trigger other events in the system.

I need to be able to control and track the clips as they can only be loaded in 1 time per game.

This has me baffled and I’d be very gratful for any help / pointers / tips.

TIA

Lel
