Function.call( ) Method | Flash 6 |
invoke a function as an object method |
The object on which theFunction is called as a method.
A list of values passed as arguments to theFunction.
The return value of theFunction.
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( ).
function moveClipTo (newX, newY) { this._x = newX; this._y = newY; } moveClipTo.call(ball_mc, 100, 200); // Moves ball_mc to 100, 200
Function.apply( ), the Arguments object; Chapter 12