I am trying to have a random color to be picked as default for my ColorPicker. I am running my script on the creation complete of my Panel.
The script code is given below:
public var someColor:String = new String();
private function init():void{
var myColor:Number = Math.round( Math.random()*0xFFFFFF );
someColor = "0x"+myColor.toString(16);
}
and the code for the ColorPicker is:
<mx:ColorPicker id="calendar_color" width="20" height="20" selectedColor="{someColor}"/>
Even though, when I see the color in the var someColor, it shows a random color every time, but the colorPicker is not displaying the color.
Please let me know, what am I doing wrong here. And how it can be fixed.
You need to add the
[Bindable]metadata: