PDA

View Full Version : Sublists of arrays? No built in function?!?


Durnus
03-15-2008, 01:24 PM
Argh! I'm trying to make a sort in Flash AS3 (a merge sort in particular) but apparently flash doesn't have a sublist function built in to the array data type. I've looked at the adobe docs, searched google, and searched these forums, but I can't find anything relating to my inquiry.

How do I get a sublist of an array? In java it's as simple as
myArray.sublist(firstindex, lastindex);

I was hoping to find a similar function in actionscript, but it appears there isn't any. :eek:

Anyone know about this? All help appreciated, except if you tell me to use the built in sorts, because that's just dodging the question. :rolleyes:

BernzSed
03-15-2008, 05:25 PM
I believe the function you're looking for is slice().

Durnus
03-15-2008, 06:08 PM
Oh, thanks. Looking at that function another time it looks different. I swear the first time I saw it it modified the origional array as well.

Thanks!

BernzSed
03-16-2008, 03:04 AM
The one you probably originally thought you saw was splice().


Anyway, no problem.