The following data types are passed by value:
String
Number
int
uint
Boolean
Null
void
All other data types are passed by reference.
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var person:Object = {name:" P Gibbons"};
capitalizeEmployeeName(person);
trace(person.name); // Displays: PETER GIBBONS
}
function capitalizeEmployeeName(employee:Object):void {
if (employee.name != null) {
employee.name = employee.name.toUpperCase();
}
}
}
}
|