Table of Contents

Function.call( ) Method Flash 6

invoke a function as an object method
theFunction.call(thisObj, param1, param2,...paramn)

Arguments

thisObj

The object on which theFunction is called as a method.

param1, ...paramn

A list of values passed as arguments to theFunction.

Returns

The return value of theFunction.

Description

The call( ) method invokes theFunction as a method of thisObj, and passes the values of param1, param2, ...paramn to theFunction as arguments. It is functionally identical to the apply( ) method, except that it specifies arguments to theFunction as a comma-delimited list, rather than as an array. For complete details, see Function.apply( ).

Example

function moveClipTo (newX, newY) {
  this._x = newX;
  this._y = newY;
}
moveClipTo.call(ball_mc, 100, 200);  // Moves ball_mc to 100, 200

See Also

Function.apply( ), the Arguments object; Chapter 12


Table of Contents