Eval () - MACROMEDIA FLASH 8-FLASH LITE 1.X ACTIONSCRIPT LANGUAGE Reference

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

Advertisement

eval ()

Availability
Flash Lite 1.0.
Usage
eval(expression)
Operands
A string containing the name of a variable, property, object, or movie clip
expression
to retrieve.
Description
Function; accesses variables, properties, objects, or movie clips by name. If
is a
expression
variable or a property, the value of the variable or property is returned. If
is an
expression
object or movie clip, a reference to the object or movie clip is returned. If the element named
in
cannot be found,
is returned.
expression
undefined
You can use
to simulate arrays, or to dynamically set and retrieve the value of
eval()
a variable.
Example
The following example uses
to determine the value of the expression
.
eval()
"piece" + x
Because the result is a variable name,
,
returns the value of the variable and
piece3
eval()
assigns it to
:
y
piece3 = "dangerous";
x = 3;
y = eval("piece" add x);
trace(y);// Output: dangerous.
The following example demonstrates how an array could be simulated:
name1 = "mike";
name2 = "debbie";
name3 = "logan";
for(i = 1; i <= 3; i++) {
trace (eval("name" add i));// Output: mike, debbie, logan
}
14
Flash Lite Global Functions

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

Table of Contents