A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: number to string conversion

  1. #1
    Junior Member
    Join Date
    Oct 2004

    number to string conversion

    var z:Number = 011;

    why does this return 9 in actionscript 2.0?

    is there a way to change the String "011" to the number 11?

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Los Angeles
    In many C-like languages, including actionscript, when an integer is specified with a leading zero, it is assumed to be in the octal (base 8) number system. 11 in octal is the same as 9 in decimal.

    Remove the leading zero.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center