Chapter 7
222
Controlling bitmap images with Lingo
Lingo lets you control bitmap images in two ways. First, you can perform simple operations that
affect the content of entire image cast members. These operations include changing the
background and foreground colors as well as switching the image that appears in a specific cast
member with that of another cast member. Each of these operations manipulates a property of the
entire image cast member.
Second, you can use Lingo to perform fine manipulations of the pixels of an image or to create
entirely new images. When you use Lingo you can be extremely flexible about which images you
display. You can create images based on dynamic information, such as user input, or based on any
other factors you want to include. To perform this kind of image operation, Lingo works with
image objects. See “Creating image objects” on page 222.
To change the image assigned to a bitmap cast member:
•
Set the
picture
cast member property. See
picture
(cast member property) in the
Lingo Dictionary.
To specify the background or foreground of a bitmap sprite:
•
Set the
backColor
or
foreColor
sprite property. See
backColor
and
foreColor
in the
Lingo Dictionary.
To capture the current graphic contents of the Stage:
•
Set a bitmap’s
picture
cast member property to the Stage’s
picture
property. See
picture
(cast member property) in the Lingo Dictionary.
For example, the
member("Archive").picture = (the stage).picture
statement makes
the current image of the Stage the image for the bitmap cast member Archive.
Creating image objects
An image object can be either a self-contained set of image data or a reference to the image data of
a cast member or of the Stage. If an image object is created by referring to a cast member, the
object contains a reference to the image of the member. The following statement creates an image
object that contains a reference to the image of the cast member called Boat.
myImage = member(“Boat”).image
Because the image object
myImage
contains a reference to the cast member Boat, any changes you
make to the object are reflected in the cast member. These changes are also reflected in any sprites
made from that cast member.
You can also create an image object that contains a reference to the graphic contents of the Stage:
myImage = (the stage).image
Any changes to this image object are reflected on the Stage.
To create an image object that is a self-contained set of image data instead of a reference to a cast
member, you must tell Lingo what kind of image you want to create. You must provide the
parameters that describe the size and bit depth of the image you are creating.
The following statement creates an image object that contains a 640 x 480 pixel, 16-bit image:
myImage = image(640, 480, 16)
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...