EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING - Page 269

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING
1130 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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 sprites 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 sprites left coordinate.
If the intPosn parameter is greater than the value of the sprites right coordinate, the returned
integer changes to the value of the sprites right coordinate.
This method does not change the sprites properties.
Both the
constrainH() and constrainV() methods constrain only one axis each.

Related product manuals