# How to retrieve values from an array to create instances of a MovieClip

**URL:** <https://forum.kirupa.com/t/how-to-retrieve-values-from-an-array-to-create-instances-of-a-movieclip/322256>\
**Category:** flash\
**Created:** [May 16, 2011, 10:53am UTC](https://forum.kirupa.com/t/how-to-retrieve-values-from-an-array-to-create-instances-of-a-movieclip/322256 "2011-05-16T10:53:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoobSurfer](https://avatars.discourse-cdn.com/v4/letter/n/e19adc/32.png) [@NoobSurfer](https://forum.kirupa.com/u/NoobSurfer)\
**Post date:** [May 16, 2011, 10:53am UTC](https://forum.kirupa.com/t/how-to-retrieve-values-from-an-array-to-create-instances-of-a-movieclip/322256/1 "2011-05-16T10:53:56Z")

</div>

I am currently trying to create a piece of code that will retrieve values from a 2D array and use them as x and y values to position instances of a MovieClip called mcMain. The code for the array will look something like this…

```auto
var lvlMain:Array = new Array();
lvlMain.push(new Array());
var xAxis:Array = new Array([150,400,200,300,100]);
var yAxis:Array = new Array([100,200,300,400,500]);

```

… with both the xAxis and yAxis storing the coordinates for the instances of mcMain.

Im a bit stuck on how to create a piece of code that would retrieve the x and y coordinates listed in the arrays and use them to create instances of mcMain. So going from the code above it would create the first instance at x=150 and y=100, second instance…fifth instance at x=100 and y=500.

Its probably pretty simple but hey, im a simple programmer 😉

So pleeaaaaase let me know how to do it if youve got the knowledge
