MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference page 309

Actionscript language reference
Table of Contents

Advertisement

Example
The following example defines the function
of the parameter:
Math.pow(x, 2)
function sqr(x:Number) {
return Math.pow(x, 2);
}
var y:Number = sqr(3);
trace(y);
// output: 9
If the function is defined and used in the same script, the function definition may appear after
using the function:
var y:Number = sqr(3);
trace(y);
// output: 9
function sqr(x:Number) {
return Math.pow(x, 2);
}
The following function creates a LoadVars object and loads params.txt into the SWF file. When
the file successfully loads,
var myLV:LoadVars = new LoadVars();
myLV.load("params.txt");
myLV.onLoad = function(success:Boolean) {
trace("variables loaded");
}
sqr
traces:
variables loaded
, which accepts one parameter and returns the
function
309

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents