Senior Member
Simple, simple... input field question
OK, I have two input text fields, one is var x1 and another is var x2
onRelease I`m trying to use this code
score = Math.sqrt (x1+1) - Math.sqrt (x2)
It`s not working, check out attached fla file
Thanks folks
Attached Files
Flashmatics
instead of using var, give your textfields instance names x1 and x2... then use
score = Math.sqrt(Number(x1.text)+1) - Math.sqrt(Number(x2.text));
Note: anything retrieved from a textfield is considered to be a string..so before applying any mathematics to their contents, you need to convert their contents to a number, using the Number function...
hope that helps
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
Click Here to Expand Forum to Full Width