Re: [Flashcoders] Array Madness - test yourself
i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
Judah, You probably need to also to provide a bit more info about the class because you must be doing something odd if you are only able to use a static array, unless your function is static as well, and that then leads into a whole bunch of questions about what your function is doing and how it is called and whether other functions are accessing the static arrays as well. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
Of cos array.length isnt really read only :-) I would suggest you post the whole function that you are using to do this as the lines of code people have suggested are correct and do work so the problem is not those lines of codes but something else and its difficult to figure this out in isolation. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Edgar Sent: Sunday, November 20, 2005 10:12 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Array Madness - test yourself Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
ooh, always beware of class prop array being initialized in declaration. if i remember correctly, with something like this: class bla{ private var arr:Array = [bli,bla]; function bla(){ } } arr would be treated as static prop of class. not a pleasant memory.. On 21/11/05, Robert Edgar [EMAIL PROTECTED] wrote: Of cos array.length isnt really read only :-) I would suggest you post the whole function that you are using to do this as the lines of code people have suggested are correct and do work so the problem is not those lines of codes but something else and its difficult to figure this out in isolation. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Edgar Sent: Sunday, November 20, 2005 10:12 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Array Madness - test yourself Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
i think the problem was i was using slice instead of the more appropriate splice in the weee hours of the morning they look so much alike. :) i will post again when i awake with a clearer head Robert Edgar wrote: Of cos array.length isnt really read only :-) I would suggest you post the whole function that you are using to do this as the lines of code people have suggested are correct and do work so the problem is not those lines of codes but something else and its difficult to figure this out in isolation. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Edgar Sent: Sunday, November 20, 2005 10:12 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] Array Madness - test yourself Well... does not work: array.slice(0) Cos its splice not slice array.length = 0; Cos length is read only array = []; Cos your only changing what the call parameter references not the underlying object So like I said before use splice(0) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 10:01 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself i spoke too soon. the alternative methods listed here do not work inside my classes. they did work in tests on frame 1. i ran into this situation inside a class. does not work: array.slice(0) array.length = 0; array = []; works: //any loop array.pop() //any loop end i dont know what it is but they are not getting removed unless i specifially use array.pop(). offhand, could it be related to the fact that i'm referencing a static array? flash ide throws errors if i do anything but use static arrays in this class. judah Mark Winterhalder wrote: On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Array Madness - test yourself
I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
Hi Judah, This is a good candidate for a 'while' loop: while(errors.length 0) { errors.pop(); } Jobe Makar http://www.electrotank.com http://www.electro-server.com phone: 919-609-0408 mobile: 919-610-5754 fax: 919-341-8104 - Original Message - From: Judah Frangipane [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Sunday, November 20, 2005 6:48 PM Subject: [Flashcoders] Array Madness - test yourself I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
Can you spot the error? yes :) why not simply do something like that: while( myArray.length ) myArray.pop(); ? mark On 11/21/05, Judah Frangipane [EMAIL PROTECTED] wrote: I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
Or if you aren't deleting everything, put i-- next to each pop(). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jobe Makar Sent: Monday, 21 November 2005 10:46 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself Hi Judah, This is a good candidate for a 'while' loop: while(errors.length 0) { errors.pop(); } Jobe Makar http://www.electrotank.com http://www.electro-server.com phone: 919-609-0408 mobile: 919-610-5754 fax: 919-341-8104 - Original Message - From: Judah Frangipane [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Sunday, November 20, 2005 6:48 PM Subject: [Flashcoders] Array Madness - test yourself I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
Better yet, why not just: myArray = []; done? - Original Message - From: Mark Winterhalder [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Sunday, November 20, 2005 6:49 PM Subject: Re: [Flashcoders] Array Madness - test yourself Can you spot the error? yes :) why not simply do something like that: while( myArray.length ) myArray.pop(); ? mark On 11/21/05, Judah Frangipane [EMAIL PROTECTED] wrote: I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
On 11/21/05, JesterXL [EMAIL PROTECTED] wrote: Better yet, why not just: myArray = []; done? usually that's what i do, but other references to the array still point to the old one, so it only works if you know for sure what references it. mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
i think that's why i couldn't use that (at the time). can you remember the situations this came up in? Mark Winterhalder wrote: On 11/21/05, JesterXL [EMAIL PROTECTED] wrote: Better yet, why not just: myArray = []; done? usually that's what i do, but other references to the array still point to the old one, so it only works if you know for sure what references it. mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
Why wouldn't you use splice(0)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark Winterhalder Sent: Sunday, November 20, 2005 12:16 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Array Madness - test yourself On 11/21/05, JesterXL [EMAIL PROTECTED] wrote: Better yet, why not just: myArray = []; done? usually that's what i do, but other references to the array still point to the old one, so it only works if you know for sure what references it. mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Array Madness - test yourself
The problem with this code is that the thing you are checking (array.length) is also what your are decrementing (by poping) and when combined with an incremental counter it wont work. ie. Loop0 i=0 length=2 Loop1 i=1 length=1(cos weve pop'd one of the array) Loop2 nevers happens as ilength is not true In this particular situation actually the easiest solution is to use Array.splice(0) which will clear the array in one command. But if you need to do processing on each loop then use a while loop var i=errors.length while(-1--i){ errors.pop() } Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Frangipane Sent: Sunday, November 20, 2005 11:48 AM To: Flashcoders mailing list Subject: [Flashcoders] Array Madness - test yourself I just want to bring to your attention a rare array problem that eluded me for years. I just realized what is going on. Whenever I tried to clear an array I would use a for loop, iterate through all the items and pop each one off. Every once in a while the arrays would still contain values and not be completely erased. Can you spot the error? Here is the code: * wrong way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) // loop through each item for (var i=0;i errors.length; i++) { trace(removing item) errors.pop() } // errors.length = 1 trace(errors.length=+errors.length) * right way * // create an array errors = new Array() // add two items errors.push(item 1) errors.push(item 2) var len = errors.length; // loop through each item for (var i=0;i len; i++) { trace(removing item) errors.pop() } // errors.length = 0 trace(errors.length=+errors.length) Look at the condition (i errors.length). If we pop an item off the end of the array then the length of the array is decreased and we do not iterate through all items in the array. Hope this helps someone. Best Regards, Judah ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Array Madness - test yourself
On 11/21/05, Robert Edgar [EMAIL PROTECTED] wrote: Why wouldn't you use splice(0)? because i wouldn't have thought of that :) seriously, splice obviously is the best solution. Judah: no, i don't remember ever needing to do that, and frankly, can't think of such a situation right now. i figured you'd know one since you asked :) mark -- http://snafoo.org/ jabber: [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders