Function.call( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
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



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net