Skip to main content
Participant
February 4, 2009
Question

need help with NaN in input fields Flash 8

  • February 4, 2009
  • 4 replies
  • 678 views
i read all the threads on this and tried alot of things, but i can't seem to figure it out. it may just be syntax, or it might be slightly beyond the limit of my understanding of this. i'm attaching my code. if anyone could take a look and tell me exactly what i SHOULD be doing, i would be very grateful.
This topic has been closed for replies.

4 replies

kglad
Community Expert
Community Expert
February 5, 2009
don't use textfield associated variables. leave that undefined.

use the textfield instance name and its text property to assign text to textfields.
kglad
Community Expert
Community Expert
February 5, 2009
you can type number_bulbs etc in your actionscript:

var number_bulbs:Number;

but that won't work if you're thinking that flash will automatically convert a string like number_bulbs = "33" into a number. you'll just get a compiler warning about a type mismatch.

and you can type and define variables outside the interface using a.s.:

var number_bulbs:Number = 33;
j_boAuthor
Participant
February 5, 2009
and you can type and define variables outside the interface using a.s.:
var number_bulbs:Number = 33;


This is where I'm stuck. When I set the value this way, the value appears in the field when the Flash Player starts. I'm trying to present a form with blank fields. I know this should be easy, but for reasons beyond my understanding, it ain't.
kglad
Community Expert
Community Expert
February 4, 2009
re-read my message. unless number_bulbs etc have already been subjected to casting as a number or an arithmetic operation, there's no way you'll see NaN for that trace().

if those variables have already been cast, trace the variable before casting.
j_boAuthor
Participant
February 4, 2009
yes. thank you. i re-read your message, traced the variables, and was able to get everything working perfectly, as long as i set the values for the variables. i know this next question is low level, but how do i set those values without having them show up in the user interface? is there a syntax for making them numbers without assigning actual numbers?
kglad
Community Expert
Community Expert
February 4, 2009
use the trace() function to see if those variables (number_bulbs etc) are defined.
j_boAuthor
Participant
February 4, 2009
i used the trace function. it outputs the same thing as my output fields - NaN.
The problem is in my using the Number() function, which apparently changed after Flash 6 and no longer interprets Text Input as anything but strings.