-
1. Re: string needs to be changed to Number only
kglad May 30, 2013 6:09 AM (in response to cabaka11)1. embed your fonts
2. don't type any text into the input text field
3. use the restrict property to restrict the input textfield text to numbers.
4. use:
change.addEventListener(MouseEvent.CLICK, converting);
function converting(e:MouseEvent) {
var convert:Number = Number (centim.text) * 2.56;
convert = Math.round(convert)
inches.text = String(convert);
}
centim.restrict="0-9"; -
2. Re: string needs to be changed to Number only
cabaka11 May 30, 2013 11:12 AM (in response to kglad)Hello,
I embeded the fonts so right now I can write the numbers. I guess I even do not need the restriction anymore but now I cannot get the code operating. I can write the number in the Input text box and then press on the button but I cannot get anything oin the dynamic text box.
And I do not get any errors neither on the grammar page nor on the output compiler page. I do not understand what is going on? Can anybody help?
Thank you for your tome and consideration.
Best,
Cagri Kasap
-
3. Re: string needs to be changed to Number only
kglad May 30, 2013 11:51 AM (in response to cabaka11)make sure both textfields have their fonts embedded and no text entered into either in the ide.
what's the following show in your output panel after clicking change:
change.addEventListener(MouseEvent.CLICK, converting);
function converting(e:MouseEvent) {
var convert:Number = Number (centim.text) * 2.56;
convert = Math.round(convert)
inches.text = String(convert);
trace(inches.text);
}
-
4. Re: string needs to be changed to Number only
cabaka11 May 30, 2013 1:25 PM (in response to kglad)Hello,
Thank you very much for your advice. It really helped a lot. Tracing the
text was very intelligent. I can see the result in the output panel. That
means the function and code was working out fine. I actually just solved
the problem.
I have forgotten to change the background color and the text color to be
different. So it was working but showing the text in the same color with
the background so I was seeing the result but not noticing it.
Thank you very much for your help.
YOU ARE THE GREATEST!!!
-
5. Re: string needs to be changed to Number only
kglad May 30, 2013 1:56 PM (in response to cabaka11)you're welcome.
(and, i've made that same text color=background color genius-move myself, more than once.)


