NOGDUS $1670.00 has been donated to NOGDUS!
September 20, 2017, 08:29:01 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: clearing an array  (Read 2009 times)
0 Members and 1 Guest are viewing this topic.
Richard Marks
Administrator
Offline Offline

Respect: 3425
« on: February 05, 2010, 06:46:28 PM »

The documentation for ActionScript states:
Quote
If you assign a value to the length property that is shorter than the existing length, the array will be truncated.

So a simple fast method to clear an array is to set the length property to zero. Cool
Code:
var myarray:Array = [10,20,30,40];

trace(myarray);
trace(myarray.length);

// clear the array
myarray.length = 0;

trace(myarray);
trace(myarray.length);
Logged

Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
.: Theme by Richard Marks :.
Valid XHTML 1.0! Valid CSS!