Question
how to set textbox style using .setStyle()
I want to make it so that when a submit button is clicked, if
an input textbox is blank, it will return a message in RED text.
But if they have entered a value for it to return a message in the
input box with GREEN text. So far this is my code, but it doesn't
change the color of the text:
check_btn.onPress = function() {
for (i=1; i<9; i++) {
if (_root["input"+i] != "") {
_root["input"+i].setStyle("fontColor", 0x00FF00);
_root["input"+i] = _root["answ_"+i];
}
if (_root["input"+i] == "") {
_root["input"+i].setStyle("fontColor", 0xFF0000);
_root["input"+i] = "Please type an answer here.";
}
}
};
I would apreciate any suggestion. Text Text Text Text
check_btn.onPress = function() {
for (i=1; i<9; i++) {
if (_root["input"+i] != "") {
_root["input"+i].setStyle("fontColor", 0x00FF00);
_root["input"+i] = _root["answ_"+i];
}
if (_root["input"+i] == "") {
_root["input"+i].setStyle("fontColor", 0xFF0000);
_root["input"+i] = "Please type an answer here.";
}
}
};
I would apreciate any suggestion. Text Text Text Text