JRBT
11-30-2004, 09:28 PM
Hi everyone,
I am building a little martgage calculator and am hitting a dead end on a simple pathing issue.
On my stage I have following:
Root Screen - "application"
Child Screen - "mortCalcForm"
Then in the child screen:
button: "calcBtn"
textfield: "numYears"
label: "numYearsLabel"
All I am trying to figure out is how to change the text within the label in the event that the content of the textfield is not a number. Here's the code on my button:
on(click){
//trace(this._parent.numYears.text);
//this._parent.numYearsLabel.text = "Incorrect Format.";
//this._parent.numYearsLabel.setStyle("color", "0xFF0000");
if(Number(this._parent.numYears.text) == "NaN"){
this._parent.numYearsLabel.text = "Incorrect Format.";
this._parent.numYearsLabel.setStyle("color", "0xFF0000");
}
}
If I uncomment the first series of commands, the label text changes, but the statements inside the if condition will not work - I can't figure out why!
I have enclosed the .fla file just in case it exposes the error of my ways.
Thanks in advance!
I am building a little martgage calculator and am hitting a dead end on a simple pathing issue.
On my stage I have following:
Root Screen - "application"
Child Screen - "mortCalcForm"
Then in the child screen:
button: "calcBtn"
textfield: "numYears"
label: "numYearsLabel"
All I am trying to figure out is how to change the text within the label in the event that the content of the textfield is not a number. Here's the code on my button:
on(click){
//trace(this._parent.numYears.text);
//this._parent.numYearsLabel.text = "Incorrect Format.";
//this._parent.numYearsLabel.setStyle("color", "0xFF0000");
if(Number(this._parent.numYears.text) == "NaN"){
this._parent.numYearsLabel.text = "Incorrect Format.";
this._parent.numYearsLabel.setStyle("color", "0xFF0000");
}
}
If I uncomment the first series of commands, the label text changes, but the statements inside the if condition will not work - I can't figure out why!
I have enclosed the .fla file just in case it exposes the error of my ways.
Thanks in advance!