# OOP - Problem with an array

**URL:** https://forum.kirupa.com/t/oop-problem-with-an-array/68015
**Category:** Uncategorized
**Created:** [October 21, 2004, 9:38am UTC](https://forum.kirupa.com/t/oop-problem-with-an-array/68015 "2004-10-21T09:38:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![anarcoma](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@anarcoma](https://forum.kirupa.com/u/anarcoma)
#### Post date: [October 21, 2004, 9:38am UTC](https://forum.kirupa.com/t/oop-problem-with-an-array/68015/1 "2004-10-21T09:38:56Z")

</div>

I encountered a rather irritating problem yesterday. I wrote a class. The class has got 1 variable of the type :Array. its a public variable.

On the scene i have 2 movieclips which are connected to my class through its linkage in the library.

My problem is that even though the instance-variable (the array) is supposed to be unique for the instance only it gets overwritten for every new instance i create.

for example. if i assign the first instance’s array 2 values (1, 1)  
and the do the same with the second but here i change the values to (2,2)  
then when i check my first instance it has got the same values as the second instance…that is (2,2).

Does anyone know whats wrong here?

the Class

```auto

class Temps extends MovieClip{
	public var arr_Temps:Array = new Array();
	
	function Temps(){}
	
	function fillArray(param_1,param_2){
		this.arr_Temps[0] = param_1;
		this.arr_Temps[1] = param_2;
	}
}

```

the fla

```auto

sqr1.fillArray(sqr2,sqr2);
sqr2.fillArray(sqr3,sqr3);

```

BR

Joakim Carlgren
