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 8550473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:57:28+00:00 2026-06-11T13:57:28+00:00

Hey all I am using Action Script and just simply trying to check if

  • 0

Hey all I am using Action Script and just simply trying to check if a string contains special characters or numbers, if it does not add it to my list otherwise error output…however the NAN is giving me the error Implicit coercion of a value of type String to an unrelated type Number…any suggestions? here is some code:

private function onAddName(event:Event):void {
        var newItem:Object = {label:addName_ti.text};
        //if not a number true then add onto list.
        if ( isNaN(addName_ti.text )
        {
            names_li.dataProvider.addItem(newItem);
            names_li.dataProvider.sortOn("label");
            addName_ti.text = "";
            addName_bn.enabled = false;
            //User feedback for successfully entering item.
            trace ("Item succesfully added!");
        } else 
        { 
            //User feedback for not succesffully entering item.
            addName_bn.enabled = false;
            trace ("Improper formatting");
        }

    }
  • 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-06-11T13:57:30+00:00Added an answer on June 11, 2026 at 1:57 pm

    isNaN expects a number. That is why you get the error. You should use parseFloat first:

    isNaN(parseFloat(addName_ti.text));
    

    parseFloat is good especially for external text, because it will ignore white space and trailing characters. It will return NaN if the parse is unsuccessful.

    " 12" would return 12. “12abc” would return 12. “abc12” would return NaN. " 12 34 5 6" would return 12.

    If you’re text is guaranteed to be well formatted, the simply casting as a number Number("12") would be slightly faster. In my test, doing it 10 million times was about 400ms quicker.

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

Sidebar

Related Questions

Hey all I'm trying to make a 3d game in with 2d sprite characters.
Hey all, I'm using this colorpicker ( http://www.eyecon.ro/colorpicker ) and am trying to capture
Hey all I'm using a MPMoviePlayerController and trying to catch my exception when there
Hey all! I am trying to post a file over Http using Java 1.4.2.
Hey all I am trying to fill a html form using a java program
Hey all i am trying to search through a CSV file using the following
Hey all trying to play with nodejs MVC using express and mongoose. I have
Hey all. I am using sifr 2.0.7 and here's the deal. The sifr is
(I'm also asking this on the OpenRasta google group) Hey all, I've been using
hey all, just getting started on hadoop and curious what the best way in

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.