While working on a project that dealt with some heavy array manipulations, I have started using more and more of Flash’s utilities for quick array modifications. A couple of useful commands are the following:

// sorting movieclips in an array by x position
myArrayofMCs.sortOn("x", Array.NUMERIC);
// Fast 'for each' method for array item operations
// This is generally faster than the common for(var i:int=0, i < arrayLength; i++) {}
for each ( var mc:MovieClip in myArrayofMCs ) mc.buttonMode = true;
// Finding the index position of an item that is in an array that was clicked on
function onClick(e:MouseEvent):void {
 var itemIndex:int = myArrayofMCs.indexOf(e.currentTarget);
}

Author: Jonathan Dunlap
Jonathan is an experienced software engineer, sole blogger of JADBOX, author of FlashMVC, humanitarian, and has contracted work for Microsoft, Coke, and Disney.
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Furl
  • LinkedIn
  • Pownce
  • Reddit
  • StumbleUpon
  • TwitThis
Auto-Generated Related Posts:
  1. Countdown to Mobile Flash Player 10...

Tags: