EasyManua.ls Logo

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING - Page 499

MACROMEDIA DIRECTOR MX 2004-DIRECTOR SCRIPTING
1130 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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