ActionScript 3 Types The Function type


Example

Functions are of the type Function:

function example():void { }
trace(example is Function); // true

They can be referenced by other variables with the type Function:

var ref:Function = example;
ref(); // ref.call(), ref.apply(), etc.

And they can be passed in as arguments for parameters whose type is Function:

function test(callback:Function):void {
    callback();
}

test(function() {
    trace('It works!');
}); // Output: It works!