MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 390

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

Example
The following function invocations are equivalent:
Math.atan2(1, 0)
Math.atan2.apply(null, [1, 0])
You could construct a SWF file that contains input entry fields that permit the user to enter the
name of a function to invoke, and zero or more parameters to pass to the function. Pressing a
"Call" button would then use the
In this example, the user specifies a function name in an input text field called
The number of parameters is specified in an input text field called
parameters are specified in text fields called
on (release) {
callTheFunction();
}
...
function callTheFunction()
{
var theFunction = eval(functionName.text);
var n = Number(numParameters);
var parameters = [];
for (var i = 0; i < n; i++) {
parameters.push(eval("parameter" + i));
}
theFunction.apply(null, parameters);
}
Function.call()
Availability
Flash Player 6.
Usage
myFunction.call(thisObject, parameter1, ..., parameterN)
Parameters
Specifies the value of
thisObject
A parameter to be passed to the
parameter1
parameters.
parameterN
Returns
Nothing.
Description
Method; invokes the function represented by a Function object. Every function in ActionScript is
represented by a Function object, so all functions support this method.
390
Chapter 12: ActionScript Dictionary
method to call the function, specifying the parameters.
apply
parameter1
within the function body.
this
myFunction
numParameters
,
, up to
parameter2
parameter10
. You can specify zero or more
.
functionName
. Up to 10
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Questions and answers

Table of Contents