Lingo Dictionary > A-C > backColor

 

backColor

Syntax

member(whichCastMember).backColor = colorNumber 
set the backColor of member whichCastMember to colorNumber 
sprite(whichSprite).backColor
the backColor of sprite whichSprite

Description

Cast member and sprite property; sets the background color of the specified cast member or sprite according to the color value assigned.

For cast members: it affects field or button cast member displays.

For sprites: setting the backColor of a sprite is the same as choosing the background color from the tool palette when the sprite is selected on the Stage. For the value that Lingo sets to last beyond the current sprite, the sprite must be a puppet. The background color applies only to 1-bit bitmap and shape cast members.

The backColor value ranges from 0 to 255 for 8-bit color and from 0 to 15 for 4-bit color. The numbers correspond to the index number of the background color in the current palette. (A color's index number appears in the color palette's lower left corner when you click the color.)

You should not apply this property to bitmap cast members deeper than 1-bit, as the results are difficult to predict.

For a movie that plays back as an applet created with the Save as Java feature of Director, specify colors for backColor using the decimal equivalent of the 24-bit hexadecimal values used in an HTML document.

For example, the hexadecimal value for pure red, FF0000, is equivalent to 16711680 in decimal numbers. This statement specifies pure red as a cast member's background color:

set the backColor of member = 16711680

This property can be tested and set.

Example

This statement changes the color of the characters in cast member 1 to the color in palette entry 250.

Dot syntax:

member(1).backColor = 250

Verbose Lingo syntax:

set the backColor of member 1 to 250

Example

The following statement sets the variable oldColor to the background color of sprite 5:

oldColor = sprite (5).backColor

Example

The following statement randomly changes the background color of a random sprite between sprites 11 and 13 to color number 36:

sprite(10 + random(3)).backColor = 36

See also

bgColor, color (sprite property)