E: me@sabisin.com | T: +49.151.68651209

as3: removing duplicates from an array

Removing duplicate items from an array in one line of ActionScript 3

var tMpaRr:Array = ["a","b","b","c","b","d","c"];

var aRr:Array = tMpaRr.filter(function (a:*,b:int,c:Array):Boolean { return ((aRr ? aRr : aRr = new Array()).indexOf(a) >= 0 ? false : (aRr.push(a) >= 0)); }, this);

trace(aRr); //a,b,c,d

Leave a Reply