A function is the basic unit of code that can be invoked in ActionScript.
Both user-defined and built-in functions in ActionScript are represented by Function objects,
which are instances of the Function class.

Methods of a class are slightly different than Function objects. Unlike an ordinary function object, a method is tightly linked to its associated class object. Therefore, a method or property has a definition that is shared among all instances of the same class. Methods can be extracted from an instance and treated as "bound" methods (retaining the link to the original instance). For a bound method, the this keyword points to the original object that implemented the method. For a function, this points to the associated object at the time the function is invoked.

apply

Specifies the value of thisObject to be used within any function that ActionScript calls.
This method also specifies the parameters to be passed to any called function. Because apply()
is a method of the Function class, it is also a method of every Function object in ActionScript.

The parameters are specified as an Array object, unlike Function.call(), which specifies
parameters as a comma-delimited list. This is often useful when the number of parameters to be passed is not
known until the script actually executes.

Returns the value that the called function specifies as the return value.

Parameters

thisArg:* (default = NaN) — The object to which the function is applied.

argArray:* (default = NaN) — An array whose elements are passed to the function as parameters.

call

Invokes the function represented by a Function object. Every function in ActionScript
is represented by a Function object, so all functions support this method.

In almost all cases, the function call (()) operator can be used instead of this method.
The function call operator produces code that is concise and readable. This method is primarily useful
when the thisObject parameter of the function invocation needs to be explicitly controlled.
Normally, if a function is invoked as a method of an object within the body of the function, thisObject
is set to myObject, as shown in the following example:

The following example uses the FunctionExample,
SimpleCollection, EventBroadcaster, and EventListener classes
to show various uses of functions in ActionScript. This is accomplished with the following steps:

The constructor for FunctionExample creates a local variable named
simpleColl, which is populated with an array of integers ranging from 1 to
8.

The simpleColl object is printed using trace().

An EventListener object, listener, is added to simpleColl.

When the insert() and remove() functions are called, the listener responds
to their events.

A second SimpleCollection object is created named greaterThanFourColl.

The greaterThanFourColl object is assigned the result of simpleColl.select()
with the argument 4 and an anonymous function. The SimpleCollection object's select method is an
internal iterator that uses the anonymous function parameter as a block.