-
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!
-
-
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);
-
-
Re: New to AS3 and struggling with converting text to number
Second what Blue Asset said. That should clear up your problem.
Gunner
-
-
Power User
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.
-
-
Banned
Re: New to AS3 and struggling with converting text to number

Originally Posted by
Carson
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
Forum Rules
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.