Your textfield is probably set to multiline or something like that.
Anything like a carriage return will cause parseInt to break.
rlyn ben wrote:
need to display number to the resultTxt but when i press the first number it
displays NaN.. when i enter the second number.. it display the number but with
the NaN.. :(
stop();
ageField.addEventListener(TextEvent.TEXT_INPUT, convertAge);
function convertAge (event:TextEvent):Number {
var resultTxt:TextField = new TextField();
resultTxt.border = true;
addChild(resultTxt);
var userAge:Number;
var ageStr:String;
ageStr = ageField.text;
userAge = parseInt(ageStr);
userAge.toString();
resultTxt.text = String(userAge);
return userAge;
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders