Optimized Flash Player 10 Z-Sorting Class

Following my earlier post on using vectors to Z-sort instead of arrays, I've updated Ralph Hauwerts SimpleZSorter util class released back in late 2008 on Lee Brimelows flash blog.

The change isn't a massive one, but does speed things up - simply it replaces the old:

important: turns it this runs slower if the z-val is outside of the range 0-1; a LOT slower, so don't use!

sortArray.sortOn("screenZ", Array.NUMERIC | Array.DESCENDING);

with the new:

sortVector.sort( function compare( x : SimpleZSortVO , y : SimpleZSortVO ) : int {    return x.screenZ - y.screenZ; } );

and here's the source all nicely zipped up, you should be able to simply drop this in your fp10 swfs as a replacement for the older version,

Thanks to Ralph for one opensourcing it and two giving me a heads up that its okay to "upgrade", sure it can still be made faster still with a bit of thought.

z-sort2

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Printed from: http://webr3.org/blog/flash-10/optimized-flash-player-10-z-sorting-class/ .
© Your Name Here 2010.

3 Comments   »

RSS feed for comments on this post , TrackBack URI

Leave a Reply

Additional comments powered by BackType

  • webr3 avatar