Parameters
Required. An integer that specifies the sprite whose horizontal coordinates are
intSpriteNum
evaluated against
Required. An integer to be evaluated against by the horizontal coordinates of the left and
intPosn
right sides of the sprite identified by
Example
These statements check the
coordinates of 40 and 60:
-- Lingo syntax
put(constrainH(1, 20)) -- 40
put(constrainH(1, 55)) -- 55
put(constrainH(1, 100)) -- 60
// JavaScript syntax
put(constrainH(1, 20)); // 40
put(constrainH(1, 55)); // 55
put(constrainH(1, 100)); // 60
This statement constrains a moveable slider (sprite 1) to the edges of a gauge (sprite 2) when the
mouse pointer goes past the edge of the gauge:
-- Lingo syntax
sprite(1).locH = _movie.constrainH(2, _mouse.mouseH)
// JavaScript syntax
sprite(1).locH = _movie.constrainH(2, _mouse.mouseH);
See also
constrainV(),
constrainV()
Usage
-- Lingo syntax
_movie.constrainV(intSpriteNum, intPosn)
// JavaScript syntax
_movie.constrainV(intSpriteNum, intPosn);
Description
Movie method; returns an integer whose value depends on the vertical coordinates of the top and
bottom sides of a sprite.
The returned integer can be one of three possible values.
•
If the
intPosn
returned integer equals
•
If the
intPosn
integer changes to the value of the sprite's top coordinate.
•
If the
intPosn
returned integer changes to the value of the sprite's bottom coordinate.
This method does not change the sprite's properties.
270
Chapter 12: Methods
.
intPosn
intSpriteNum
constrainH
Movie
parameter is between the values of the sprite's top and bottom coordinates, the
.
intPosn
parameter iis less than the value of the sprite's top coordinate, the returned
parameter iis greater than the value of the sprite's bottom coordinate, the
.
function for sprite 1 when it has left and right
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers