array sort in flash
- Started
- Last post
- 42 Responses
- JamesEngage0
apology accepted ;)
- caseyc0
James, I didnt realize that was Flash 7 only, here's a func to do it in 6. Blargh.
- gabriel20
that script sorts both the 'a' array and 's' array.
- instantok0
what he showed does just that
- gabriel20
unfit, is there a way to create a sorted copy of an array without modifying the original?
- unfittoprint0
a = new Array(100,20,50);
s = a.sort();
compare values and construct another array with the index numbers.
caseyc is right, magic is real and muggles are fags.
- gabriel20
here's some documentation on what he was describing:
- JamesEngage0
Cheers Gabriel, I have already sorted it... but will look at your code later... am intrigued by that one line solution though by casey
- gabriel20
hey james,
I couldn't load the code you posted (404 error) but I've put this together that should do what you're looking for:
http://gabeshackle.com/upload/ar…
let me know if that helps...
- JamesEngage0
I want to see this magic code too trust me!
- tomkat0
use this to paste code that won't show up in HTML restricted sites.
and I would like to see the final result, if possible ; )
- JamesEngage0
I did... does it work in Flash 6? No.
- caseyc0
*Begin Arnold soundclip*
Yooou son of a bitch...
*End Arnold soundclip*
What I posted does not sort the original, it does exactly what you asked for, it "will create a new array that reports the order in which they exist"
Test before posting next time, ya heard!?
- JamesEngage0
right... subject closed! sorted now... can stop posting how to sort an array now, as this is not what I was after.
THE END
- caseyc0
You can do it like this bro:
myOrder = myArray.sort(8);
- jkosoy0
dammit. NT needs to be more Flash friendly. :)
- JamesEngage0
haha
- jkosoy0
why not make tempLo = null initially and then in your loop if tempLo
- JamesEngage0
ah yes... I'm doing a 800 * 600 website... otherwise I'd of made it bigger... or something... the -1 one is not really needed and is just to give the variable a value
- jkosoy0
the -1 and the 1000. won't that insinuate that you won't have a number greater than 1000 or less than -1?