Chapter 3
144
Examples
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
put newColorObj
-- paletteIndex(45)
This statement changes the color of the fourth through the seventh characters of text member
myQuotes:
member("myQuotes").char[4..7].color = rgb(200, 150, 75)
This Lingo displays the color of sprite 6 in the Message window, and then sets the color of sprite
6 to a new RGB value:
put sprite(6).color
-- rgb( 255, 204, 102 )
sprite(6).color = rgb(122, 98, 210)
Note:
Setting the
paletteIndex
value of an RGB color type changes
colorType
to
paletteIndex
. Setting
the RGB color type of a
paletteIndex
color sets its
colorType
value to RGB.
See also
bgColor
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...