/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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" );