Call: (209) 560-6611

Remove duplicate variable from array in as3

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

Below is a function that removes duplicated from an array in ActionScript 3. Just pass the function a variable name.

 Javascript |  copy code |? 
01
02
function removeDuplicate(arr:Array) : void{
03
    var i:int;
04
    var j: int;
05
    for (i = 0; i < arr.length - 1; i++){
06
        for (j = i + 1; j < arr.length; j++){
07
            if (arr[i] === arr[j]){
08
                arr.splice(j, 1);
09
            }
10
        }
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.

what is 5 in addition to 8?

Before you post, please prove you are sentient.

What is the outer covering of a tree?