> I'm looking for a way to create an array with only unique values.
I usually use a hash table (aka. an actionscript object); the values can
just be "true". E.g.
obj={};
for(var ix=0;ix<myArr.length;++ix)obj[myArr[ix]]=true;
Then if you needed the data back in the array you could do:
myArr=[];
for(var key in obj)myArr[]=key;
Maybe that's inefficient, and there is a better way?
Darren
>
> I looked into useing Array.UNIQUESORT but this will not remove duplicate
> entries.
> It only stops the sorting process if it finds a duplicate.
>
>
> For example I would like to
> var myArr:Array = new
> Array("oranges","oranges","oranges","oranges","oranges","oranges","oranges",
> "apples", "strawberries");
>
> myArr.uniqueSort() // ???? Possibly extend the Array Class???
>
> // if the uniqueSort method existed it would return this.
> trace(myArr);
> // output: "oranges", "apples", "strawberries"
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org