Hi,

I am trying to set selectedColor of the colorPicker component to the color of a TextFormat. colorPicker.selectedColor is of type uint and TextFormat.color of type object. I looked around and found this function:

Code:
function fixColorCode( color:Object, hasAlpha:Boolean = false ):uint
{
	if( color is String ){
		var pattern:RegExp = /#/;
		color = uint( color.toString().replace( pattern,"0x" ) );
	}else if( !( color is Number ) ){
		color = Number( color );
	}

	var max:Number = ( hasAlpha ) ? 0xFFFFFFFF : 0xFFFFFF;
	return uint( Math.min( Math.max( color, 0 ), max ) );
}
The last line returns the following error: "1118: Implicit coercion of a value with static type Object to a possibly unrelated type Number."

Anyone knows how to do this?

Thanks!