Complex data types, like Array, pass values by reference. : Function parameters : Function Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Function » Function parameters »

 

Complex data types, like Array, pass values by reference.


 

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();
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Function
» Function parameters