Passing arguments by reference

Hi,

I have a really simple question about AS: Is it possible to pass arguments “by reference” instead of “by value”. I know it’s possible in almost every programming/scripting language I came across until today, but I didn’t find any hint for doing it in Actionscript :frowning:

For those who don’t know what “by reference” means: If you want to pass a Number to a function, say


var mynumber:Number = 5; 
calculate(mynumber);

and you change the value of the argument inside the function, e.g.


function calculate(num:Number) {
  num += 1;
}

then the call to calculate normally does NOT change the value of mynumber because you have passed mynumber “by value”, which means the value of mynumber has been copied to the num argument. This means mynumber is 5 all the time.
Now sometimes u want to be changing arguments given to a function inside the function, and this is where u will normally use references. Passing mynumber “by reference” would mean that after calling calculate the value of mynumber will be 6…

I know complex Objects like MovieClips are passed by reference. But how to do it with simple DataTypes like Number, Boolean etc.???