# Troulbe loadins Sound from Array

**URL:** <https://forum.kirupa.com/t/troulbe-loadins-sound-from-array/192921>\
**Category:** flash\
**Created:** [July 2, 2006, 10:08pm UTC](https://forum.kirupa.com/t/troulbe-loadins-sound-from-array/192921 "2006-07-02T22:08:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tfoston](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tfoston/32/2516_2.png) [@tfoston](https://forum.kirupa.com/u/tfoston)\
**Post date:** [July 2, 2006, 10:08pm UTC](https://forum.kirupa.com/t/troulbe-loadins-sound-from-array/192921/1 "2006-07-02T22:08:39Z")

</div>

I’m making a sound gallery. The track information comes from an XML file. I draw the track location information from the xml file into an array. I’m also drawing additional track information from the xml file into a seperate array. The problem is when i try to access the array values for the track into a onPress function for one of my movies (made dynamiclly) the track array information comes up undefined. Here is my code

var playlist:XML = new XML() //creates new xml object to recieve xml data  
playlist.ignoreWhite = true  
playlist.load(“playlist.xml”) //loads my xml playist

var mysound:Sound = new Sound() // creates new sound object

playlist.onLoad = function(){ //once the xml file has loaded do the following

```
var numoftracks = playlist.firstChild.childNodes.length //number of tracks in the gallery
var descarray:Array = new Array() //new array to hold track descriptions
var trackarray:Array = new Array() //new array to hold track location info 

```

for(i=0; i\<numoftracks; i++){

```
 _root.attachMovie("template", "temp_mc"+i, i) //attach the black box to the stage
_root["temp_mc"+i]._y = (i*50) //black box y placement
_root["temp_mc"+i]._x = (i*50) // black box x placement

trackarray.push(playlist.firstChild.childNodes*.firstChild.firstChild) //adding to my array
descarray.push(playlist.firstChild.childNodes*.lastChild.firstChild) //adding to my array
_root["temp_mc"+i].title_txt.text = descarray* //displays track description on black box

var track:XMLNode = playlist.firstChild.childNodes*.firstChild.firstChild //the track location

_root["temp_mc"+i].onPress = function(){ //black box on press, play this track
    mysound.loadSound(trackarray*, true) //This always comes up "undefined"
     trace(trackarray*) //same here
}
trace(trackarray*) //but not here
    
}//end for loop

```

}//end playlist.onLoad

The trackarray\* value just disappears when inside the \_root[“temp\_mc”+i].onPress function. Can someone tell me why this is happening?
