# Passing array to class

**URL:** <https://forum.kirupa.com/t/passing-array-to-class/243405>\
**Category:** flash\
**Created:** [November 6, 2007, 6:27pm UTC](https://forum.kirupa.com/t/passing-array-to-class/243405 "2007-11-06T18:27:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [November 6, 2007, 6:27pm UTC](https://forum.kirupa.com/t/passing-array-to-class/243405/1 "2007-11-06T18:27:07Z")

</div>

The answer to this is probably simple but I’m not getting it…

Class ArrayTest:

```auto

package {
 
 import flash.display.*;
 
 public class ArrayTest extends Sprite {
  private var thisArray:Array;
 
  public function ArrayTest(thisArray):void {
   thisArray = new Array();
   trace("in ArrayTest, array = " + thisArray);
  }
 }
 
}

```

fla:

```auto

var myArray:Array = [76, 89, 4];
trace ("myArray = " + myArray);
var aaa:ArrayTest = new ArrayTest(myArray);
addChild(aaa);

```

Resulting trace:

[FONT=Courier New]myArray = 76,89,4[/FONT]  
[FONT=Courier New]in ArrayTest, array =[/FONT]

Question: What am I doing wrong that ArrayTest is not getting the values in myArray?

One thing I tried is changing

trace("in ArrayTest, array = " + thisArray);

to

trace("in ArrayTest, array = " + thisArray\*\*.toString()\*\*);

…but that didn’t work.

Thanks!

EDIT: I fixed it. get rid of **thisArray = new Array();** in ArrayTest.
