Below is a function that allowed you to remove a variable from an array based on the variable name in ActionScript 3. The as3 function takes 2 variables to work, the 'varName' and the 'arrayName'. The 'varName' is the name of your variable you want to delete from the array. The 'arrayName' is the name of the array.
Javascript | | copy code | | ? |
01 | |
02 | //remove array variable from array based on the variable name |
03 | function removeArrayVar(varName, arrayName):void |
04 | { |
05 | var countD:Number = 0; for(var t3:Object in arrayName){ |
06 | if(varName == arrayName[t3]){ |
07 | trace("removed "+varName+" from array!"); |
08 | arrayName.splice(t3,1 ) |
09 | } |
10 | countD++; |
11 | } |
12 | } |
13 |