Other Entries

Log

Numbers with Leading Zeroes in Actionscript

Actionscript has an undocumented (at least as far as I can tell) “feature” that causes numbers beginning with the character “0” and consisting of digits all less than 8 to be treated as octals (base-8 numbers). This is actually consistent with javascript’s function, so I guess it wouldn’t be completely undocumented.

The solution is to use parseInt(num, 10), which converts it to a base-10 number. Seems odd that it would default to this behavior without escaping.

Here’s an example of it in action:

08/03/04 04:40PM Flash Geekiness

Recently Played on iTunes

  1. “My Sharona”
    Frat Rock: The '70s
    The Knack
    06/04/11 09:27
  2. “The KKK Took My Baby Away”
    Anthology
    The Ramones
    06/04/11 09:25
  3. “My Sharona”
    Frat Rock: The '70s
    The Knack
    06/04/11 09:24

Last 100 Songs >