Passing an object doesn't really act differently than passing a primitive type. It's just that you no longer have to change the actual value of the parameter, you get to change it's properties. To show that it's not different, the following code should NOT alter the original value:
Code:function fu1():Void { var box:Array = [32]; fu2(box); trace(box[0]); } function fu2(input:Array):Void { input = [64]; // does NOT change box contents from fu1 } fu1(); // Output should be 32




Reply With Quote