![MACROMEDIA DIRECTOR MX 2004 Reference Download Page 696](http://html1.mh-extra.com/html/macromedia/director-mx-2004/director-mx-2004_reference_687516696.webp)
696
Chapter 14: Properties
color()
Usage
color(
#rgb, redValue, greenValue, blueValue
)
color(
#paletteIndex, paletteIndexNumber
)
rgb(
rgbHexString
)
rgb(
redValue, greenValue, blueValue
)
paletteIndex(
paletteIndexNumber
)
Description
Function and data type; determines an object’s color as either RGB or 8-bit palette index values.
These are the same values as those used in the
color
member and
color
sprite properties, the
bgColor
member and
bgColor
sprite properties, and the
bgColor
Stage property.
The
color
function allows for either 24-bit or 8-bit color values to be manipulated as well as
applied to cast members, sprites, and the Stage.
For RGB values, each color component has a range from 0 to 255, and all other values are
truncated. For
paletteIndex
types, an integer from 0 to 255 is used to indicate the index
number in the current palette, and all other values are truncated.
Example
This statement performs a math operation:
palColorObj = paletteIndex(20)
put palColorObj
-- paletteIndex(20)
put palColorObj / 2
-- paletteIndex(10)
This statement converts one color type to another type:
newColorObj = color(#rgb, 155, 0, 75)
put newColorObj
-- rgb(155, 0, 75)
newColorObj.colorType = #paletteIndex
put newColorObj
-- paletteIndex(106)
This statement obtains the hexadecimal representation of a color regardless of its type:
someColorObj = color(#paletteIndex, 32)
put someColorObj.hexString()
-- "#FF0099"
This statement determines individual RGB components and the
paletteIndex
value of a color
regardless of its type:
newColorObj = color(#rgb, 155, 0, 75)
put newColorObj.green
-- 0
put newColorObj.paletteIndex
-- 106
newColorObj.green = 100
put newColorObj.paletteIndex
-- 94
put newColorObj
-- rgb(155, 100, 75)
newColorObj.paletteIndex = 45
Summary of Contents for DIRECTOR MX 2004
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...