+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New to AS3 and struggling with converting text to number

    Hello!

    I am creating a simple form which asks the client a yes or no question. I created a input text box for a Y or N response. Based on the users response the form performs a calculation. If the answer is Y the form plugs in a 1; if the answer is N the form plugs in a 0.

    I can't seem to get this to work. I've tried using an if/then statement, I've tried setting a variable. But, I can't get it to work.

    Does anyone have any advice?

    Thank you!

  2. #2
    Junior Member
    Join Date
    Jun 2011
    Posts
    24
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: New to AS3 and struggling with converting text to number

    to convert a number to string you use mytext = String(mynumber);
    and to convert a string to a number you can use mynumber = parseInt(mytext);

    also you could use a simple if for your problem

    var answer:int;

    if(userinput.text == "y")
    {
    answer = 1;
    }
    else
    {
    answer = 0;
    }

    myfunction(answer);

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Location
    Near Pittsburgh, PA USA
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: New to AS3 and struggling with converting text to number

    Second what Blue Asset said. That should clear up your problem.
    Gunner

  4. #4
    Power User
    Join Date
    Mar 2011
    Location
    Kentucky
    Posts
    230
    Thanks
    5
    Thanked 7 Times in 7 Posts

    Re: New to AS3 and struggling with converting text to number

    I didn't even know there was a programming language called AS3 XD, I'm missing out, but it kinda looks alittle like a mixture of Javascript, and C++ if i'm not mistaken.

  5. #5
    Banned
    Join Date
    Sep 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New to AS3 and struggling with converting text to number

    Quote Originally Posted by Carson View Post
    I didn't even know there was a programming language called AS3 XD, I'm missing out, but it kinda looks alittle like a mixture of Javascript, and C++ if i'm not mistaken.
    Actionscript 3. It's for flash only.

 

 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Powered by vBulletin® Version 4.1.9
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
Content Relevant URLs by vBSEO 3.6.0
Copyright 2011 Photoshop Gurus Forum. All rights reserved.
All times are GMT -5. The time now is 11:56 AM.
vBulletin Skins