I recently needed function that would remove duplicate values from an array. After looking around online and modifying what I found to fit my needs I came up with the following:
var arr:Array = ["a", "b", "c", "a", "d", "a", "a"];
removeDuplicates(arr);
trace(arr);
function removeDuplicates(target:Array):void
{
for(var i:uint=target.length; i>0; i--)
{
if(target.indexOf(target[i-1]) != i-1)
{
target.splice(i-1, 1);
}
}
}
If you are searching for a way to do this, I hope this helps!