DISQUS

CoderHump: Array Ordering in ActionScript 3

  • Rob · 11 months ago
    Interesting observation about the atom ordering...but if a specific order is important to your code, why not push/unshift your transitions into a second (tightly-packed) array as they're initialized, then iterate over that one? Or maybe drop a marker variable onto your ITransition type and have the Transitions work as a linked list?
  • Ben Garney · 11 months ago
    In this case, I'm using a serialization system to fill the array, and it's easier to make (or borrow) an Array-compatible class that preserves the order than it is to change the serialization system.

    In a more general context, PHP lets you have ordered associative arrays, and it's quite useful - you often store results from a database indexed by primary key and ordered by the order your SQL query returned them, for instance. Maybe having a built-in way to do that in Flash would be helpful (even if the default Array doesn't).

    I wish they would document what WILL be in order and what won't, though. That's part of what cost me two days to fix this problem.
  • Ben Garney · 11 months ago
    I filed a bug about this for the Tamarin VM team: https://bugzilla.mozilla.org/show_bug.cgi?id=47...