Specifying a custom color

The Set Custom Color command specifies new color values for a symbol based on percentages and offsets of the symbol's current RGB and alpha values.

Note: You should use Set Tint rather than Set Custom Color to change an object to a solid color.

The Percentage setting changes the color of a symbol by multiplying the percentage by the values in the channel. The Offset setting adds or subtracts the offset value from the channel as a whole. The overall calculation for the new color is as follows:

Percentage * Current Value + Offset = New Color Value

To specify a custom color for an instance:

1 Create a movie clip or graphic symbol and place an instance of the symbol on the Stage.
2 Make sure the Generator inspector is displayed by choosing Window > Inspectors > Generator.
3 Select the symbol instance.
4 In the Generator inspector, choose Set Custom Color from the pop-up menu.
5 Specify either a variable or a value for the following fields:
Percent Red, Percent Green, Percent Blue, and Percent Alpha specify the percentage of the symbol's red, green, blue, and alpha values to use in the new color value. Valid values range from -100 to 100.
Offset Red, Offset Green, Offset Blue, and Offset Alpha specify how much to increase or decrease the respective channels value.

Because percentage and offset values act on the channel as a whole, they are applied to all color values that appear within the symbol. For example, say you have three objects in one symbol: one red (RGB = 255, 0, 0), one gray (RGB = 125, 125, 125), and one black (RGB = 0, 0, 0). You apply the following values for Set Custom Color:

Percent Red 50
Offset Red 0
Percent Green 50
Offset Green 0
Percent Blue 50
Offset Blue 0
Percent Alpha 100
Offset Alpha 0

The calculations to obtain the new color values would be performed as follows:

Red Object (RGB 255, 0, 0)
	Percent Red (50) * current value (255) + offset (0) =126.5 (round up to 127)
	Percent Green (50) * current value (0) + offset (0) =0
	Percent Red (50) * current value (0) + offset (0) =0
New Custom Color = 127, 0, 0
Grey Object (RGB 125, 125, 125)
	Percent Red (50) * current value (125) + offset (0) =62.5 (round up to 63)
	Percent Green (50) * current value (125) + offset (0) =62.5 (round up to 63)
	Percent Red (50) * current value (125) + offset (0) =62.5 (round up to 63)
New Custom Color = 63, 63, 63
Black Object (RGB 0, 0, 0)
	Percent Red (50) * current value (0) + offset (0) =0
	Percent Green (50) * current value (0) + offset (0) =0
	Percent Red (50) * current value (0) + offset (0) =0
New Custom Color = 0, 0, 0

The sum effect of the Set Custom Color command on the symbol would be to lighten the red and gray objects only. The black object would not be changed.


 
Guidelines for using Set Custom Color

These are important guidelines for using the Set Custom Color command:

Negative numbers for percentage values generally are not useful. A negative percentage multiplied by a positive channel value yields a negative value for the channel. Because the RGB and alpha channel values are expressed exclusively in positive integers from 0 to 255, a negative value would always be treated as a value of 0 for the channel. Negative values for offsets, however, are useful for subtracting units from the channel.
Because RGB and alpha channel values are fixed within the range of 0 to 255, calculations that result in numbers above or below this range default to the maximum or minimum value in the range accordingly.
To specify that all objects within a group be modified to the same custom color, you can specify an RGB percentage of 0 and specify the custom color's RGB values in positive offsets per channel. For example, to make everything medium purple (RGB 160, 0, 200), the settings for Set Custom Color would be as follows:
Percent Red 0
Offset Red 160
Percent Green 0
Offset Green 0
Percent Blue 0
Offset Blue 200
Percent Alpha 100
Offset Alpha 0
A percentage value of 0 sets the original color value for a channel to 0. By placing the RGB values for the desired color in the Offset fields for each channel, you are specifying that every object in the channel be assigned that color. It is both easier and more efficient to use Set Tint for this purpose.