# Arrays in Function Problems

**URL:** https://forum.kirupa.com/t/arrays-in-function-problems/49459
**Category:** flash
**Created:** [April 22, 2004, 10:27pm UTC](https://forum.kirupa.com/t/arrays-in-function-problems/49459 "2004-04-22T22:27:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jmumm](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@jmumm](https://forum.kirupa.com/u/jmumm)
#### Post date: [April 22, 2004, 10:27pm UTC](https://forum.kirupa.com/t/arrays-in-function-problems/49459/1 "2004-04-22T22:27:07Z")

</div>

Why does this work

```auto

for (k=0; k<files.length; k++) {
	newfile_mc.onRelease = function() {
		trace(files);
		trace(k);
	}
}

```

but this doesn’t work?

```auto

for (k=0; k<files.length; k++) {
	newfile_mc.onRelease = function() {
		trace(files[k]);
	}
}

```

I have files defined as an array in the code above this.
