Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:10:16+00:00 2026-05-22T19:10:16+00:00

I am using Actionscript 2.0 In a Brand new Scene. My only bit of

  • 0

I am using Actionscript 2.0

In a Brand new Scene. My only bit of code is:

    trace(int('04755'));
    trace(int('04812'));

Results in:

  • 2541

  • 4812

Any idea what I am doing wrong/silly?

By the way, I am getting this source number from XML, where it already has the leading 0. Also, this works perfect in Actionscript 3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:10:16+00:00Added an answer on May 22, 2026 at 7:10 pm

    Converting a string with a leading 0 to a Number in ActionScript 2 assumes that the number you want is octal. Give this function I’ve made for you a try:

    var val:String = '00010';
    
    function parse(str:String):Number
    {
        for(var i = 0; i < str.length; i++)
        {
            var c:String = str.charAt(i);
            if(c != "0") break;
        }
    
        return Number(str.substr(i));
    }
    
    trace(parse(val)); // 10
    trace(parse(val) + 10); // 20
    

    Basically what you want to do now is just wrap your string in the above parse() function, instead of int() or Number() as you would typically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi when I add a new component using Actionscript I want it to fade
How do you trigger a javascript function using actionscript in flash? The goal is
How do you reference a bitmap on the stage in flash using actionscript 3?
I'm having trouble sending out a simple HTTP request using Actionscript 3's Socket() object.
Is it possible, using actionscript 3 to disable the right click menu? Any help
How do I change text color using flash actionscript 2?
I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial
Using ActionScript 2.0, how do I show or hide a button onclick? I am
Using actionscript, how do I find if the following string contains the substring assets/Wallpaper
is it possible using actionscript to determine what operating system the flash projector is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.