View Full Version : [AS3] sortOn question.
Valaran
October 20th, 2008, 05:04 AM
Array.sortOn(); How is this sort performed, and how does it differ from just doing a simple loop through the array and sort based on that? Let's imagine I didn't think of this function while developing something, and I happened to sort things by looping through it, would there be any significant difference on switching my ugly loop to this?
Thank you.
ViktorHesselbom
October 20th, 2008, 05:27 AM
Depending on how your loop operates it could be faster or slower. It will look cleaner though.
Are you also asking how to use it? Just specify a property to sort by sortOn ("name"); sortOn ("y", Array.NUMERIC);
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html#sortOn()
Valaran
October 20th, 2008, 06:31 AM
No, I wasn't asking how to use it, but thanks for the rest of the reply, I'll do some testing on it.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.