03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In Flash 4, you can also use eval() to dynamically set <strong>and</strong> retrieve the value of a variable or<br />

instance name. However, you can also do this with the array access operator ([]).<br />

In Flash 5 or later, you cannot use eval() to dynamically set <strong>and</strong> retrieve the value of a<br />

variable or instance name, because you cannot useeval() on the left side of an equation. For<br />

example, replace the code<br />

eval ("var" + i) = "first";<br />

with this:<br />

this["var"+i] = "first"<br />

or this:<br />

set ("var" + i, "first");<br />

Parameters<br />

expression:Object - The name of a variable, property, object, or movie clip to retrieve. This<br />

parameter can be either a String or a direct reference to the object instance (i.e use of<br />

quotation marks (" ") is optional.)<br />

Returns<br />

Object - A value, reference to an object or movie clip, or undefined .<br />

Example<br />

The following example uses eval() to set properties for dynamically named movie clips. This<br />

ActionScript sets the _rotation property for three movie clips, called square1_mc,<br />

square2_mc, <strong>and</strong> square3_mc.<br />

for (var i = 1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!