Josh Brittain
Josh Brittain

Reputation: 2212

Disabled Button loses TextFormat

I have a button with a custom textformat that I set via the setStyle method such as:

var tf:TextFormat = new TextFormat();
tf.font = "Arial";

var button:Button = new Button();
button.setStyle("textFormat", tf);
button.label = "Click Me";

However when this button is disabled it loses its textFormat. Reseting the text format after disabling the button does not affect it.

What can I do to still apply the textformat to a disabled button?

Thanks in advance.

Upvotes: 0

Views: 338

Answers (1)

loxxy
loxxy

Reputation: 13151

I believe you could access textField of the button.

Then use defaultTextFormat instead of setTextFormat.

 var tf:TextFormat = new TextFormat();
 tf.font = "Arial";
 my_textBox.defaultTextFormat = tf;

Apparently above wont work, but this would :

button.setStyle("disabledTextFormat", tf);

Upvotes: 3

Related Questions