Skip to main content
Participating Frequently
June 27, 2006
Question

how to set textbox style using .setStyle()

  • June 27, 2006
  • 1 reply
  • 292 views
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
This topic has been closed for replies.

1 reply

Participating Frequently
June 27, 2006
TextFormat();