constrainH()
269
Parameters
intPaletteIndex
Required if using 8-bit palette values. An integer that specifies the 8-bit palette
value to use. Valid values range from 0 to 255. All other values are truncated.
intRed
Required if using RGB values. An integer that specifies the red color component in the
current palette. Valid values range from 0 to 255. All other values are truncated.
intGreen
Required if using RGB values. An integer that specifies the green color component in
the current palette. Valid values range from 0 to 255. All other values are truncated.
intBlue
Required if using RGB values. An integer that specifies the blue color component in the
current palette. Valid values range from 0 to 255. All other values are truncated.
Example
These statements display the color of sprite 6 in the Message window, and then set the color of
sprite 6 to a new value:
-- Lingo syntax
put(sprite(6).color) -- paletteIndex(255)
sprite(6).color = color(137)
put(sprite(6).color) -- paletteIndex(137)
// JavaScript syntax
put(sprite(6).color) // paletteIndex(255);
sprite(6).color = color(137);
put(sprite(6).color) // paletteIndex(137);
constrainH()
Usage
-- Lingo syntax
_movie.constrainH(
intSpriteNum
,
intPosn
)
// JavaScript syntax
_movie.constrainH(
intSpriteNum
,
intPosn
);
Description
Movie method; returns an integer whose value depends on the horizontal coordinates of the left
and right sides of a sprite.
The returned integer can be one of three possible values.
•
If the
intPosn
parameter is between the values of the sprite’s left and right coordinates, the
returned integer equals
intPosn
.
•
If the
intPosn
parameter is less than the value of the sprite’s left coordinate, the returned
integer changes to the value of the sprite’s left coordinate.
•
If the
intPosn
parameter is greater than the value of the sprite’s right coordinate, the returned
integer changes to the value of the sprite’s right coordinate.
This method does not change the sprite’s properties.
Both the
constrainH()
and
constrainV()
methods constrain only one axis each.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
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...