Call (Function.call Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

See also

call (Function.call method)

call (Function.call method)
public call(thisObject:Object, [parameter1:Object])
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 (
function call operator produces code that is concise and readable. This method is primarily
useful when the
thisObject
controlled. Normally, if a function is invoked as a method of an object, within the body of the
function,
thisObject
myObject.myMethod(1, 2, 3);
In some situations, you might want
function must be invoked as a method of an object, but is not actually stored as a method of
that object:
myObject.myMethod.call(myOtherObject, 1, 2, 3);
You can pass the value null for the
function and not as a method of an object. For example, the following function invocations
are equivalent:
Math.sin(Math.PI / 4)
Math.sin.call(null, Math.PI / 4)
Returns the value that the called function specifies as the return value.
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
thisObject:Object
body.
parameter1:Object
specify zero or more parameters.
Returns
) operator can be used instead of this method. The
()
parameter of the function invocation needs to be explicitly
is set to
, as shown in the following example:
myObject
thisObject
thisObject
- An object that specifies the value of
[optional] - A parameter to be passed to the myFunction. You can
to point somewhere else; for example, if a
parameter to invoke a function as a regular
thisObject
within the function
Function
369

Advertisement

Table of Contents
loading

Table of Contents