Call: (209) 560-6611

Remove variable from array based on variable name in as3

Date: December 12, 2014 Author: ang Category: Tutorials Tags: Comments: 0

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

Earth orbits the ...

Before you post, please prove you are sentient.

what is 5 in addition to 2?