Lingo Dictionary > A-C > constrainV() |
![]() ![]() ![]() |
constrainV()
Syntax
constrainV (
whichSprite
,
integerExpression
)
Description
Function; evaluates integerExpression
and then returns a value that depends on the vertical coordinates of the top and bottom edges of the sprite specified by whichSprite
, as follows:
![]() |
When the value is between the top and bottom coordinates, the value doesn't change. |
![]() |
When the value is less than the top coordinate, the value changes to the value of the top coordinate. |
![]() |
When the value is greater than the bottom coordinate, the value changes to the value of the bottom coordinate. |
This function does not change the sprite properties.
Example
These statements check the constrainV
function for sprite 1 when it has top and bottom coordinates of 40 and 60:
put constrainV(1, 20) -- 40 put constrainV(1, 55) -- 55 put constrainV(1, 100) -- 60
Example
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:
set the locV of sprite 1 to constrainV(2, the mouseV)
See also
bottom
, constraint
, top
, constrainH()
![]() ![]() ![]() |