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.

}<br />

default :<br />

trace("Weekend");<br />

See also<br />

switch statement<br />

delete statement<br />

delete reference<br />

Destroys the object reference specified by the reference parameter, <strong>and</strong> returns true if the<br />

reference is successfully deleted; false otherwise. This operator is useful for freeing memory<br />

used by scripts. You can use the delete operator to remove references to objects. After all<br />

references to an object are removed, Flash Player takes care of removing the object <strong>and</strong> freeing<br />

the memory used by that object.<br />

Although delete is an operator, it is typically used as a statement, as shown in the following<br />

example:<br />

delete x;<br />

The delete operator can fail <strong>and</strong> return false if the reference parameter does not exist or<br />

cannot be deleted. You cannot delete predefined objects <strong>and</strong> properties, nor can you delete<br />

variables that are declared within a function with the var statement. You cannot use the<br />

delete operator to remove movie clips.<br />

Returns<br />

Boolean - A Boolean value.<br />

Parameters<br />

reference:Object - The name of the variable or object to eliminate.<br />

Example<br />

Usage 1: The following example creates an object, uses it, <strong>and</strong> deletes it after it is no longer<br />

needed:<br />

var account:Object = new Object();<br />

account.name = "Jon";<br />

account.balance = 10000;<br />

trace(account.name); //output: Jon<br />

delete account;<br />

trace(account.name); //output: undefined<br />

174 ActionScript language elements

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

Saved successfully!

Ooh no, something went wrong!