Function Statement - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

The following example uses
var myArray:Array = new Array("one", "two", "three");
for (var index in myArray)
trace("myArray["+index+"] = " + myArray[index]);
// output:
myArray[2] = three
myArray[1] = two
myArray[0] = one
The following example uses the
type of child:
for (var name in this) {
if (typeof (this[name]) == "movieclip") {
trace("I have a movie clip child named "+name);
}
}
If you have several movie clips, the output consists of the instance names of those clips.
The following example enumerates the children of a movie clip and sends each to Frame 2 in
itsrespective Timeline. The
,
_RedRadioButton_
for (var name in RadioButtonGroup) { RadioButtonGroup[name].gotoAndStop(2);
}

function statement

Usage 1: (Declares a named function.)
function functionname([parameter0, parameter1,...parameterN]){
statement(s)
}
Usage 2: (Declares an anonymous function and returns a reference to it.)
function ([parameter0, parameter1,...parameterN]){
statement(s)
}
Comprises a set of statements that you define to perform a certain task. You can define a
function in one location and invoke, or call, it from different scripts in a SWF file. When you
define a function, you can also specify parameters for the function. Parameters are
placeholders for values on which the function operates. You can pass different parameters to a
function each time you call it so you can reuse a function in different situations.
Use the
statement in a function's
return
return, a value.
212
ActionScript language elements
to iterate over the elements of an array:
for..in
operator with
typeof
RadioButtonGroup
_GreenRadioButton_,
statement(s)
to iterate over a particular
for..in
movie clip is a parent with three children:
, and
_BlueRadioButton_
to cause a function to generate, or
.

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF