rect (Image)
945
rect (Image)
Usage
-- Lingo syntax
imageObjRef
.rect
// JavaScript syntax
imageObjRef
.rect;
Description
Image property. Returns a rectangle describing the size of a given image. Read-only.
The returned rectangle coordinates are given relative to the top left corner of the image.
Therefore, the left and top values of the rectangle are 0, and the right and bottom values are the
width and height of the cast member.
Example
This statement returns the rectangle of the 300 x 400 pixel member Sunrise in the
message window:
-- Lingo syntax
member("Sunrise").image.rect -- rect(0, 0, 300, 400)
// JavaScript syntax
member("Sunrise").image.rect; // rect(0, 0, 300, 400)
This Lingo looks at the first 50 cast members and displays the rectangle and name of each cast
member that is a bitmap:
-- Lingo syntax
on showAllRects
repeat with x = 1 to 50
if member(x).type = #bitmap then
put member(x).image.rect && "-" && member(x).name
end if
end repeat
end
// JavaScript syntax
function showAllRects() {
var x = 1;
while(x < 51) {
var tp = member(x).type;
if (tp = "bitmap") {
trace(member(x).image.rect + " - " + member(x).name);
i++;
}
}
}
See also
height
,
image()
,
width
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...