[Flashcoders] remove duplicate items in array

2007-05-22 Thread Allandt Bik-Elliott (Receptacle)
hi guys i'm looking for a way of removing duplicate items in an array i've done this so far //sort array so all items of the same content are grouped together myArray.sort(); //loop through items, removing any sitting next to a duplicate for (var i:Number = 0; i myArray.length; i++) {

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread R�kos Attila
Don't you think that you should take into consideration that the length of the array can change during the loop? Attila ABER //loop through items, removing any sitting next to a duplicate ABER for (var i:Number = 0; i myArray.length; i++) { ABER if (myArray[i] == myArray[i+1]) { ABER

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread eric e. dolecki
You could prevent duplicates from being placed into the array in the first place. Or http://proto.layer51.com/d.aspx?f=1196 You could rewrite a prototype as a regular function that takes the array as an argument. - eric On 5/22/07, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: hi

RE: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Munson, Scott
To: flashcoders Subject: [Flashcoders] remove duplicate items in array hi guys i'm looking for a way of removing duplicate items in an array i've done this so far //sort array so all items of the same content are grouped together myArray.sort(); //loop through items, removing any sitting next

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Steven Sacks
From my XArray mixin class (all 3 are needed). /** * Returns a new array by removing duplicate values in Array. */ Array.prototype.uniq = function() { var r = []; var l = this.length; for (var a = 0; a l; a++) { if (!r.has(this[a])) r.push(this[a]);

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Allandt Bik-Elliott (Receptacle)
yeh - i started trying to do that but just got myself into a moody bluddle - i'll prolly go back and try to rewrite it a bit cleaner when i'm happy i'll hit deadline here's what i ended up with - var myTempArray:Array = [];

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Allandt Bik-Elliott (Receptacle)
8o thankyou On 22 May 2007, at 18:56, Steven Sacks wrote: From my XArray mixin class (all 3 are needed). /** * Returns a new array by removing duplicate values in Array. */ Array.prototype.uniq = function() { var r = []; var l = this.length; for (var a = 0; a l;

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Allandt Bik-Elliott (Receptacle)
i could barely read that - it looks ammmaaazing :D thanks eric - when's the next super samurai book coming out? :) On 22 May 2007, at 18:18, eric e. dolecki wrote: You could prevent duplicates from being placed into the array in the first place. Or http://proto.layer51.com/d.aspx?f=1196

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread eric e. dolecki
holy wow - super samurai ;) I didn't know many even saw that one... On 5/22/07, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: i could barely read that - it looks ammmaaazing :D thanks eric - when's the next super samurai book coming out? :) On 22 May 2007, at 18:18, eric e.

Re: [Flashcoders] remove duplicate items in array

2007-05-22 Thread Allandt Bik-Elliott (Receptacle)
i had to order it from the states - it was great On 22 May 2007, at 19:58, eric e. dolecki wrote: holy wow - super samurai ;) I didn't know many even saw that one... On 5/22/07, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: i could barely read that - it looks ammmaaazing :D