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 |