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 that thing with fingers at the end of your arm (one word)?

Before you post, please prove you are sentient.

what is 7 + 7?

Back to Top