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--;
}
}
}