Search
Archives

You are currently browsing the archives for the Flash/Flex category.

Archive for the ‘Flash/Flex’ Category

Sorting if flash AS3 is now easy!


Sort Array of Strings


Array.sort(); //Easy Alpha

Array.sort(compareFunction);

function compareFunction(a:String, b:String){ }

  • Negative = A before B
  • Zero = Same
  • Positive = B before A

Array.sort(options);

  • 1 or Array.CASEINSENSITIVE
  • 2 or Array.DESCENDING
  • 4 or Array.UNIQUESORT
  • 8 or Array.RETURNINDEXEDARRAY
  • 16 or Array.NUMERIC

Array.Sort(CompareFunciton, Options);


Sort Array of Objects


Array.sortOn(fieldName); //Easy Alpha

Array.sort(compareFunction);

function compareFunction(a:Object, b:Object){ }

  • Negative = A before B
  • Zero = Same
  • Positive = B before A

Array.sortOn(fieldName, options);

  • 1 or Array.CASEINSENSITIVE
  • 2 or Array.DESCENDING
  • 4 or Array.UNIQUESORT
  • 8 or Array.RETURNINDEXEDARRAY
  • 16 or Array.NUMERIC