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.

This method does not change the sprite's properties.

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

Parameters

intSpriteNum Required. An integer that identifies the sprite whose vertical coordinates are evaluated against intPosn.

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

Example

These statements check the constrainV function for sprite 1 when it has top and bottom coordinates of 40 and 60:

-- Lingo syntax
put(constrainV(1, 20)) -- 40
put(constrainV(1, 55)) -- 55
put(constrainV(1, 100)) -- 60

// JavaScript syntax
put(constrainV(1, 20)); // 40
put(constrainV(1, 55)); // 55
put(constrainV(1, 100)); // 60

This statement constrains a moveable slider (sprite 1) to the edges of a gauge (sprite 2) when the mouse pointer moves past the edge of the gauge:

-- Lingo syntax
sprite(1).locV = _movie.constrainV(2, _mouse.mouseH)

// JavaScript syntax
sprite(1).locV = _movie.constrainV(2, _mouse.mouseH);

See also

constrainH(), 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_met59.htm