# Choose from Array of Containers?

**URL:** <https://forum.kirupa.com/t/choose-from-array-of-containers/172385>\
**Category:** flash\
**Created:** [December 13, 2005, 9:24pm UTC](https://forum.kirupa.com/t/choose-from-array-of-containers/172385 "2005-12-13T21:24:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![earph](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/earph/32/79_2.png) [@earph](https://forum.kirupa.com/u/earph)\
**Post date:** [December 13, 2005, 9:24pm UTC](https://forum.kirupa.com/t/choose-from-array-of-containers/172385/1 "2005-12-13T21:24:57Z")

</div>

I need my script to randomly choose between the 3 containers on the stage. Here’s what I have so far, but I’m not sure what to put in place of the “box” section of the script.

```auto
var items:Array = new Array("artExchange", "austinVentures", "axcelis");
var containers:Array = new Array("1", "2", "3");
		
	function randomImage() {
		
	nr = Math.floor(Math.random()*items.length);
        ct = Math.floor(Math.random()*containers.length);

	box.attachMovie(items[nr], "thang", 1);
}

```

Where I’m confused is how to change my target container which is currently “box”, to the call the random variable “ct” instead.

```auto
box.attachMovie(items[nr], "thang", 1);

```
