What is wrong with my code? I get this error:
Initializer for 'color': cannot parse value of type uint from text 'colorUint'.
Code:
public static function convertStringToUint(value:String, mask:String):uint
{
var colorString:String = "0x" + value;
var colorUint:uint = mx.core.Singleton.getInstance("mx.styles::IStyleManager2").getColorNa me( colorString );
return colorUint;
}
<s:Button id="Battery" x="10" y="44" width="60" height="30" label="Battery" fontSize="10" color="colorUint"/>
Hi,
That didnt work, im getting a new warning:
Multiple markers at this line:
-Data binding will not be able to detect assignments to "colorString".
-NewBatteryStatus
I also tried to bind the variable.
public var colorString:String;
<s:Button id="Battery" x="10" y="44" width="60" height="30" label="Battery" fontSize="10" color="{colorString}"/>
-Data binding will not be able to detect assignments to "colorString".
Means you need to add [Binding] to the variable.
[Bindable]
public var colorString:String;
The other issues is that a String is not a uint. A uint is a numeric value. So, after you create your String color value, you have to cast it as a uint.
<s:Button id="Battery" x="10" y="44" width="60" height="30" label="Battery" fontSize="10" color="{new uint(colorString)}"/>
North America
Europe, Middle East and Africa
Asia Pacific