rect()
499
var myRectWidth1 = myRect.right - myRect.left; // 50
var myRectWidth2 = myRect[3] - myRect[1]; // 50
To see an example of
rect()
used in a completed movie, see the Imaging movie in the Learning/
Lingo folder inside the Director application folder.
Parameters
intLeft
Required. An integer that specifies the number of pixels that the left side of the rectangle
is from the left edge of the Stage.
intTop
Required. An integer that specifies the number of pixels that the top side of the rectangle
is from the top edge of the Stage.
intRight
Required. An integer that specifies the number of pixels that the right side of the
rectangle is from the left edge of the Stage.
intBottom
Required. An integer that specifies the number of pixels that the bottom side of the
rectangle is from the top edge of the Stage.
Example
This statement sets the variable
newArea
to a rectangle whose left side is at 100, top is at 150,
right side is at 300, and bottom is at 400 pixels:
-- Lingo syntax
newArea = rect(100, 150, 300, 400)
// JavaScript syntax
var newArea = rect(100, 150, 300, 400);
In Lingo only, the following statement sets the variable
newArea
to the rectangle defined by the
points
firstPoint
and
secondPoint
:
-- Lingo syntax
firstPoint = point(100, 150)
secondPoint = point(300, 400)
newArea = rect(firstPoint, secondPoint)
In Lingo only, these statements add and subtract values for rectangles:
-- Lingo syntax
put(rect(0, 0, 100, 100) + rect(30, 55, 120, 95)) -- rect(30, 55, 220, 195)
put(rect(0, 0, 100, 100) -rect(30, 55, 120, 95)) -- rect(-30, -55, -20, 5)
In Lingo only, this statement adds 80 to each coordinate in a rectangle:
-- Lingo syntax
put(rect(60, 40, 120, 200) + 80) -- rect(140, 120, 200, 280)
In Lingo only, this statement divides each coordinate in a rectangle by 3:
-- Lingo syntax
put(rect(60, 40, 120, 200) / 3) -- rect(20, 13, 40, 66)
See also
point()
,
quad
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...