What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

New to AS3 and struggling with converting text to number


Avzlvlzv

Member
Messages
19
Likes
0
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!
 
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);
 
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.
 

Back
Top