# Using Variables in an Array

**URL:** <https://forum.kirupa.com/t/using-variables-in-an-array/295543>\
**Category:** flash\
**Created:** [September 1, 2009, 4:27am UTC](https://forum.kirupa.com/t/using-variables-in-an-array/295543 "2009-09-01T04:27:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aesthetics7](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@aesthetics7](https://forum.kirupa.com/u/aesthetics7)\
**Post date:** [September 1, 2009, 4:27am UTC](https://forum.kirupa.com/t/using-variables-in-an-array/295543/1 "2009-09-01T04:27:09Z")

</div>

I think I am getting pretty close here but can anyone direct me in the right direction to be able to return the values in the array in a sequential order?

```auto

var twentythreeX:Number = 0;
var unihiphopX:Number = -320;
var unimetalX:Number = -760;
var myLoc:Array = [twentythreeX, unihiphopX, unimetalX];

trace(myLoc[0])
trace(myLoc[1])

//worknextbtn_mc.x=myLoc[0]
//worknextbtn_mc.y=myLoc[1]

next_mc.addEventListener(MouseEvent.CLICK, nextClick);

for(var i:int = 0; i<myLoc.length ; i++){
    next_mc.addEventListener(MouseEvent.CLICK, nextClick);
} 

    function nextClick(event:MouseEvent):void{
trace(myLoc*)
trace(myLoc[1])
}

```

This is for a simple slide show just when the next button is pressed it will tween to those coordinates. Thanks!:hitman2:
