rodrigoalex
09-13-2009, 02:18 PM
Hello guys, I would like to feed a text box dynamically, seeing as I called:
import mx.controls.Text;
public var msgError: Text;
public function CheckForm (): void (
msgErro = new Text ();
imgErro = new Image ();
msgErro.setStyle ( "right", "50");
msgErro.setStyle ( "top", "55");
msgErro.width = 200;
msgErro.height = 50;
imgErro.source = ".. / images/ warning.png";
imgErro.setStyle ( "right", "5");
imgErro.setStyle ( "top", "55");
canvascontract.addChild (msgErro);
canvascontract.addChild (imgErro);
if (comp_na.text == "") {
msgErro.text = "Sorry, but the field Company Name can not be empty";
} else if (email_cont.text == "") {
msgErro.text = "Sorry, but the Contact Email field can not be empty";
} Else if (email_cont.text.indexOf ("@") == -1) {
msgErro.text = "Sorry, but this is not a valid email";
}
}
But the problem is that it supports the text, ie not erase another message and then put the new, simply appears on top of another, how could fix this?
import mx.controls.Text;
public var msgError: Text;
public function CheckForm (): void (
msgErro = new Text ();
imgErro = new Image ();
msgErro.setStyle ( "right", "50");
msgErro.setStyle ( "top", "55");
msgErro.width = 200;
msgErro.height = 50;
imgErro.source = ".. / images/ warning.png";
imgErro.setStyle ( "right", "5");
imgErro.setStyle ( "top", "55");
canvascontract.addChild (msgErro);
canvascontract.addChild (imgErro);
if (comp_na.text == "") {
msgErro.text = "Sorry, but the field Company Name can not be empty";
} else if (email_cont.text == "") {
msgErro.text = "Sorry, but the Contact Email field can not be empty";
} Else if (email_cont.text.indexOf ("@") == -1) {
msgErro.text = "Sorry, but this is not a valid email";
}
}
But the problem is that it supports the text, ie not erase another message and then put the new, simply appears on top of another, how could fix this?