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
>[email protected]
>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>
>  
>

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to