Remove Redundant Items From an Array | ActionScript 3.0 (AS3)

The following code is an example of how to remove redundant elements from an Array.

var foundIndex:int;
if (theArray && theArray.length > 0){
                var len:int = theArray.length;
                for (var i:int; i < len; i++){
                    if (i+1 < len){
                        foundIndex = theArray.indexOf(theArray[i], i+1);
                    } else {
                        foundIndex = -1;
                    }
                    if (foundIndex == -1){
                       //not redundant
                    } else {
                       theArray.splice(i,1);
                        i--;
                        len--;
                    }
                }
            }

Comments (0)add comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security image
Write the displayed characters


busy