Possible Duplicate:
Can you have "ByRef" arguments in AS3 functions?
Primitive types in AS3 pass by value instead of reference. Is there a way to override that behavior and pass by reference for certain variables? Take the following code:
for (var i=0; i<4; i++) {
for (var j=0; j<4; j++) {
if(i==0 && j==0){
switch(currentRotation){
case 0:
var1 = j; //I want var 1 to be a reference to j, not the value of j
break;
}
}
if(someArray[var1][var2]){
//stuff
}
}
}
If this isn’t possible, I guess I’ll just have to copy and paste the code a few times. :/
Thanks
You may cheat a bit. Wrap
jinto some object: