Function Statement - 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

The following example shows using
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);
}
}
Note: 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
their respective Timelines. The
children,
_RedRadioButton_
for (var name in RadioButtonGroup) { RadioButtonGroup[name].gotoAndStop(2);
}

function statement

Usage 1: (Declares a named function.)
parameter1,...parameterN]){statement(s)}
and returns a reference to it.)
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.
198
ActionScript language elements
to iterate over the elements of an array:
for..in
operator with
typeof
RadioButtonGroup
,
_GreenRadioButton_,
function functionname([parameter0,
function ([parameter0, parameter1,...parameterN]){
statement(s)
to iterate over a particular
for..in
movie clip is a parent with several
and
_BlueRadioButton_
Usage 2: (Declares an anonymous function
to cause a function to generate, or
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Table of Contents