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.

This method does not change the sprite's properties.

Both the constrainH() and constrainV() methods constrain only one axis each.

Parameters

intSpriteNum Required. An integer that specifies the sprite whose horizontal coordinates are evaluated against intPosn.

intPosn Required. An integer to be evaluated against by the horizontal coordinates of the left and right sides of the sprite identified by intSpriteNum.

Example

These statements check the constrainH function for sprite 1 when it has left and right 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(), Movie


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/director/mx2004/release_update_en/07_met58.htm