Just use a method to return the hex value.
function get_uint_from_colour(red:int, green:int, blue:int) {
return red << 16 | green << 8 | blue;
}
So in your example:
graphics.lineStyle(lineThickness, get_uint_from_colour(120, 120, 12));
In response to your comment about needing to use a set of pre-defined Color
objects, you will still need to (at some point) convert them to the type uint
as this is the accepted data-type for the lineStyle
method.
My suggestion would be to adjust the get_uint_from_colour
method to accept a Color
object. Like so:
function get_uint_from_colour(colour:Color) {
return int(colour.redMultiplier) << 16 | int(colour.greenMultiplier) << 8 | int(colour.blueMultiplier);
}
So in your code:
graphics.lineStyle(lineThickness, get_uint_from_colour(lineColor));
Please note that I have changed the name of my original method as I felt it better describes the function
Also, keep in mind that a Color
object can hold much more information about itself than a standard Hex colour can - this superfluous information will be lost in the process of converting it.