I am creating a component and want to expose a color property as many flex controls do, lets say I have simple component like this, lets call it foo_label:
<mx:Canvas>
<mx:Script>
[Bindable] public var color:uint;
</mx:Script>
<mx:Label text="foobar" color="{color}" />
</mx:Canvas>
and then add the component in another mxml file, something along the lines of:
<foo:foo_label color="red" />
When I compile the compiler complains: cannot parse value of type uint from text 'red'. However if I use a plain label I can do
<mx:Label text="foobar" color="red">
without any problems, and the color property is still type uint.
My question is how can I expose a public property so that I can control the color of my components text? Why can I use the string "red" as a uint field for the mx controls but cannot seem to do the same in a custom component, do I need to do something special?
Thanks.