Revision: 5479
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 11, 2008 12:17 by imhugo
Initial Code
// Creates Array
var myArray:Array = ["item1", "item2", "item3", "item4", "item5"];
// Function
function removeItemFromArray( item:String ):Void
{
trace("Array Original: " + myArray);
// Array Lenght
var arrayLenght:Number = myArray.length;
// Searches item in array
for ( i =0; i<arrayLenght; i++ )
{
// Finds item and removes it
if ( myArray[i] == item )
{
myArray.splice( i, 1 );
trace("Item Removed: " + myArray[i] + newline);
trace("Array Updated: " + myArray);
}
}
}
// Calls Function
removeItemFromArray( "item3" );
Initial URL
Initial Description
Initial Title
Removes specific item from Array
Initial Tags
actionscript, array
Initial Language
ActionScript