Not quite sure if I asked correctly, but basically I have an array that stores some var(int/numbers). And when I loop through the array changing the numbers of the var, at the end the number seems still unchanged. You would have a better idea of what I’m talking about base on the below code.
private var _numArray:Array = new Array()
private var _no1:int
private var _no2:int
public function Main():void
{
_no1 = 10
_no2 = 20
_numArray.push(_no1)
_numArray.push(_no2)
while (_numArray.length)
{
_numArray[0] = 0
_numArray.splice(0, 1)
}
trace(_no1, _no2) // still returning 10 , 20
}
If you want the array to store references instead of values, you’ll need to use a non-primitive datatype. Among the primitive datatypes are
int,uint,Number,BooleanandString. A non-primitive (complex) datatype is anything else.