Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you change a Label's color at runtime in ActionScript 3.0?

I get the following error:

1119: Access of possibly undefined property color through a reference with static
type mx.controls:Label.

The thing about that is that, in the MXML, color is an attribute of Label. But if I try to say something like:

lblUpgrade.color = "#000000";

it throws this error. I've been trying to find a work-around for the last 45 minutes. How can I set this at runtime? Thanks!

like image 263
Panzercrisis Avatar asked Jun 21 '12 16:06

Panzercrisis


1 Answers

Label does not have a color property, rather it has a color style which can be set like so:

lblUpgrade.setStyle("color","#000000");
like image 167
NoobsArePeople2 Avatar answered Sep 24 '22 18:09

NoobsArePeople2