User Guide
Statements 189
Usage 4: The following example shows the behavior of delete on object references:
var ref1:Object = new Object();
ref1.name = "Jody";
// copy the reference variable into a new variable
// and delete ref1
ref2 = ref1;
delete ref1;
trace("ref1.name "+ref1.name); //output: ref1.name undefined
trace("ref2.name "+ref2.name); //output: ref2.name Jody
If ref1 had not been copied into ref2, the object would have been deleted when ref1 was
deleted because there would be no references to it. If you delete
ref2, there are no references
to the object; it will be destroyed, and the memory it used becomes available.
See also
var statement
do..while statement
do { statement(s) } while (condition)
Similar to a while loop, except that the statements are executed once before the initial
evaluation of the condition. Subsequently, the statements are executed only if the condition
evaluates to
true.
A
do..while loop ensures that the code inside the loop executes at least once. Although this
can also be done with a
while loop by placing a copy of the statements to be executed before
the
while loop begins, many programmers believe that do..while loops are easier to read.
If the condition always evaluates to
true, the do..while loop is infinite. If you enter an
infinite loop, you encounter problems with Flash Player and eventually get a warning message
or crash the player. Whenever possible, you should use a
for loop if you know the number of
times you want to loop. Although
for loops are easy to read and debug, they cannot replace
do..while loops in all circumstances.
Availability: ActionScript 1.0; Flash Lite 1.0
Parameters
condition:Boolean - The condition to evaluate. The statement(s) within the do block of
code will execute as long as the
condition parameter evaluates to true .