# Using Array Data

**URL:** https://forum.kirupa.com/t/using-array-data/305827
**Category:** flash
**Created:** [March 4, 2010, 6:46am UTC](https://forum.kirupa.com/t/using-array-data/305827 "2010-03-04T06:46:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bidum00](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@bidum00](https://forum.kirupa.com/u/bidum00)
#### Post date: [March 4, 2010, 6:46am UTC](https://forum.kirupa.com/t/using-array-data/305827/1 "2010-03-04T06:46:16Z")

</div>

I have loaded content into an array and have displayed that data in a dynamic text field. What I need to do now is take that same array data and append it to a gotoAndPlay command.

example:  
var myArray:Array = new Array(); // lets pretend a button has been clicked and loaded (event.target.name) into the array

//I can then display the contents of the array in a text box  
myTextBox.text = myArray[0]; //this works well

but I need to also do this  
myMovieClip.myArray[0].gotoAndPlay(“start”); in which will actually end up being myMovieClip.home.gotoAndPlay(“start”)

How do I write this the correct way

----actual code-----

var myMenuArray = [home, about]; //1 button duplicated with instance names to reflect  
for each (var btn in myMenuArray)  
{  
btn.addEventListener(MouseEvent.CLICK, onBtnClick);  
}

var detectArray:Array = new Array();

function onBtnClick (event:MouseEvent):void  
{  
transition.visible= true;  
transition.gotoAndPlay(“transPlay”);  
transition.addEventListener(Event.EXIT\_FRAME,transitionFrameDetect);  
detectArray[0] = event.currentTarget.name;

}

function transitionFrameDetect(event:Event)  
{  
if (transition.currentFrame == 50)  
{  
transition.removeEventListener(Event.EXIT\_FRAME,transitionFrameDetect);  
transition.visible = false;  
trace(“Transition has reached Frame 50”)  
butBox1.text = detectArray[0]; //displays what the array data is  
pages.detectArray[0].gotoAndPlay(“transPlay”); //code not working  
}  
else  
{  
trace(“Waiting for transition movie clip to reach frame 50”);  
}

}
