by Eric Ladd
Macromedia became a household name almost overnight when it released Shockwave for Director-a Netscape Navigator plug-in that allows Director movies to be played right in the browser window. Director movies are carefully orchestrated multimedia presentations that combine text, graphics, audio, and video content into stunning desktop displays. Multimedia artists commonly use Director to author CD-ROM titles, kiosk exhibits, and desktop multimedia presentations. Now, thanks to Shockwave, they can also author presentations specifically for the Web.
This chapter discusses the essentials of Macromedia Director and
how to prepare your Director movies for the Web.
| NOTE |
A book this size could be written on Macromedia Director alone! What you find in this chapter should be considered just the briefest introduction to Director. To learn more, consult Que's Creating Shockwave Web Pages. |
Before learning how to do some of the cool things you can do in Director, you need to spend a little time familiarizing yourself with the basic tools of the program and how they work together.
Imagine that you are a director whose job it is to create a movie. What things do you need at your disposal to accomplish your task? Your answer might include things like the following:
Macromedia Director uses a movie-making metaphor as the backdrop for the program. Director has four basic program components that are analogous to the preceding list of items (see Figure 29.1). They are
Each of these components is discussed in the sections that follow.
The Stage As you might suspect, the stage is where all the action occurs. When you play a movie, the cast members do their thing on the stage according to the actions prescribed in the score. Figure 29.2 shows the stage with a movie playing.
When the cast, score, or control panel windows are open, they
obscure your view of the stage. To remove them from sight, you
can use options under the Director Window menu. Choosing Window,
Control Panel removes the control panel. Similarly, choosing Window,
Score gets rid of the score. You can hide any casts you're using
by choosing Window, Cast and select the type of cast you want
hidden from the pop-up list.
| TIP |
Pressing Ctrl+1 hides all open windows except the stage. This is a useful keystroke right before playing a movie. |
The Cast A cast is a collection of multimedia elements that are the building blocks of the presentation. You can make just about any kind of multimedia file a cast member. Director supports the following file types for inclusion in the cast:
A new feature supported by Director 5.0 is multiple casts. Every movie has an internal cast that can be used only in that movie (see Figure 29.3). Beyond that, you can create external casts that are shared between movies. This is very handy when you're making movies that have several cast members in common. These cast members can be stored in an external cast and made available to all of the movies, rather than having to place them in the internal casts of each movie.
The Score The score is the most complicated of the program components, but it's also where you can be at your creative best. The Director score window is shown in Figure 29.4.
A given column of the score holds the contents of a given frame of the movie. As a movie plays, the playback head moves along the frames in numerical order (unless told to do otherwise by a script), displaying the contents of each frame as it passes by.
Each row of the score is called a channel. There are six reserved channels (the first six you see in the figure) and 48 channels you can use to place cast members. The reserved channels are used to control certain aspects of the movie. From top to bottom, the reserved channel are as follows:
The remaining 48 channels are for you to use for whatever you
choose.
| TROUBLESHOOTING |
I've placed a cast member in a channel, but I can't see it. One of two things may be going on. First, check the button to the left of the number of the channel where you placed the cast member. If the button is pressed, it suppresses the display of all items in that channel. Click the button again to display the contents of the channel. The other problem might be with the hierarchy the channels adhere to. Items placed in a given channel have precedence on the stage over those in channels with a lower number. If you still can't see the cast member, check to see if it's being obscured by something else in the same frame with a higher channel number. |
Each individual box in the score is called a cell. Generally, you choose members from the cast and place them in cells in the score. When you do this, you really place a copy of the cast member, not the cast member itself, into the score. The copy of a cast member in a given cell is called a sprite. For this reason, Director channels are also sometimes called sprite channels.
The Control Panel The control panel is like a remote control for Director's playback functions (see Figure 29.5). In addition to Stop, Play, and Rewind buttons, you can find controls for the movie tempo (in frames per second or seconds per frame), volume (muted or levels 1 through 7), looping playback, and for stepping forward or backward in the sequence of frames. The numerical readout displays the number of the frame that the playback is currently on.
One of the first things you're likely to do when getting ready to author a movie is gather your cast together. When you start a new movie (choose File, New, Movie), you automatically get an internal cast. To populate the cast, follow these instructions:
| TIP |
If you're browsing for a certain type of file, you can select it in the Files of Type field in the Import dialog box. This should help you narrow your search. |
Remember that members of an internal cast are only available to the movie you're currently authoring. If you want some cast members to be available to other movies, you should consider placing those cast members in an external cast. To create an external cast, you need to follow these steps:
One of Director's many nice features is the Paint window. By double-clicking
a cast member, you open up a copy of it in the Paint window. There
you can edit the cast member using the many functions provided.
| NOTE |
The Director Paint window provides you with most of the functionality found in most graphics editors, including drawing, painting, flipping, rotating, lightening, and darkening. |
With a cast in place, you're ready to write the score-the script for your movie. While there are many ways to do this, one of the most basic tasks is placing cast members on the stage. To place a cast member on the stage, follow these steps:
Note in the score window that when you highlight a cell containing a sprite, the cast member the sprite is made from shows up in the upper-left corner. You can double-click this smaller copy of the cast member to open it in the Paint window.
Very often, you need the same cast member in the same channel for several subsequent frames. Fortunately, you don't have to drag the cast member to the stage for each new frame that you need it. To extend the cast member you just placed out to frame 25, you can do the following:
Remember that a sprite is an image of a cast member at a given point in the score. A sprite has several properties that a cast member alone does not have. These properties include the following:
You can alter any of a sprite's properties by doing the following:
| TIP |
You can also access the Sprite Properties dialog box by highlighting the sprite and then right-clicking it to reveal a context-sensitive menu that has a Sprite Properties option on it. |
Probably Director's most exciting capability is how easy it is to generate animations. Director animations come in many flavors, as follows:
Each of these is reviewed in the sections that follow.
Step recording is the most painstaking way to create an animation. The basic idea is that you record the position of a sprite in one frame, advance to the next frame, move the sprite to a new position, record the new position, advance to the next frame, and so on until you're done.
If you want to make your CD-ROM graphic move across the stage, you can do so with a step-recorded animation as follows:
To create a real-time recorded animation, you move the cast member you want to animate across the stage, and Director records it and writes it into the score.
To animate your CD-ROM icon with real-time recording, follow these steps:
In-betweening is a very easy way to create an animation. All you need to do is place the beginning and ending frames of the animation and then ask Director to fill in the rest!
To animate your CD-ROM using in-betweening, follow these steps:
The in-betweening function takes care of figuring out how the
position of the sprite on the stage has to change to produce a
smooth animation.
| TIP |
Drag the new copy of the sprite down the channel by several frames. The more frames Director has to work with, the smoother your animation will look. |
The ANIMWIZ feature is new to Director 5.0, though Director 4.0 had a similar feature called Auto Animate. To access ANIMWIZ and reveal the dialog box shown in Figure 29.17, choose Xtras, ANIMWIZ.]
Figure 29.17 : ANIMWIZ makes it easy to create banners, zooms, rolling credits, and bulleted lists.
| NOTE |
Windows users: You are not seeing things! The iconography, typography, and buttons in the ANIMWIZ dialog box look much more like a Macintosh interface than a Windows interface. |
Banner Figure 29.17 also shows you the Banners tab of the ANIMWIZ dialog box. From this tab, you can set up a scrolling text message on the stage. To do this, follow these steps:
Zooms Zooms make text grow larger or smaller, depending how you set them up. To create a zoom, you need to complete the Zooms tab of the ANIMWIZ dialog box. This is accomplished with the following steps:
Credits A rolling list of credits is typical at the end of a movie and you can create the same effect with Director. By choosing the Credits tab of the ANIMWIZ dialog box (see Figure 29.18), you can specify all the options you need to create the credits list. To accomplish this, you just:
Figure 29.18 : Give credit where credit is due with the ANIMWIZ's Credits feature.
Bullets Bulleted lists are frequently used in PowerPoint presentations or HTML pages to convey information in an easy-to-understand format. You can create bulleted lists in Director and get many of the nice presentation effects you get when creating with PowerPoint.
To create your animated bulleted list, follow these steps:
Lingo is Director's scripting language. It is based on English-language words and, if read out loud, it describes what the script is doing. To see for yourself, consider the following simple Lingo script:
on mouseDown puppetSprite 4, TRUE set the locV of sprite 4 to 324 end
The script says that when the mouse button is pressed down, Director should set the vertical location of sprite 4 to 324 pixels below the top of the stage.
There are four types of scripts you can write in Director. Each type is written in Lingo, but they are at different positions in Director's script hierarchy. The following are the four main types:
| NOTE |
Director 5.0 also supports parent scripts, which are used to create child objects. Child objects are instances of the parent script applied to a certain situation. The relationship between parent scripts and child objects is analogous to classes and class instances in object-oriented programming. |
Frame scripts are lowest on the pecking order. They yield control to any other type of script. Cast scripts yield control to sprite and movie scripts. Sprite scripts can be overridden only by a movie script.
You place a script in a frame using the script channel in the score. To begin the script, just double-click the cell where the script should go. This action opens the script editing window you see in Figure 29.19.
Note in Figure 29.19 that the script shows up near the top of
the score window. The large button that shows some of the lines
of code in the script can be clicked to reopen the script editing
window if you need to edit it later. Note also that the new script
becomes part of the cast.
| NOTE |
When you're done entering a script, closing the script editing window compiles and saves the script for you. |
A commonly used frame script is:
on exitFrame go to the frame end
This instructs Director to go back to the frame that it is leaving, thereby creating an "infinite loop." Having such a loop is useful because you can stop the action on a frame with the loop and set up some special condition (a particular keystroke, for example) to jump you out of the loop.
Cast scripts are scripts affiliated with a particular cast member. Whenever you place a cast member that has its own script, the script comes along for the ride and becomes part of the score. You compose a cast script inside the cast script editing window (see Figure 29.20).
Cast scripts are appropriate when you always want to associate certain functionality with a cast member. For example, if you have a cast number that is a clickable button, you could give it the cast script:
on mouseDown set the backColor of member 10 to 255 updatestage end
With the script above, Director changes the background color of cast member number 10 to white whenever a user clicks the button.
You can make a script part of a given sprite, but you need to make the sprite a puppet before it will yield to a sprite script. To declare a sprite as a puppet, you use the following Lingo in the script channel of the frame where the sprite resides:
on exitFrame
puppetSprite 1, true
end
After the sprite is puppeted, you can compose the sprite script in the Movie Script editing window (see Figure 29.21).
Figure 29.21 : Once puppeted, a sprite can have its own Lingo script.
You need to puppet a sprite whenever you want to control sprite properties using Lingo commands. One common task is to move the sprite to a new location on the stage. To do this, you can use a sprite script like the following:
on mouseUp puppetSprite 17, TRUE set the locH of sprite 17 to 142 set the locV of sprite 17 to 327 end
Once you puppet sprite 17, you can change its horizontal (locH)
and vertical (locV) coordinates on the stage using the
Lingo set command.
| NOTE |
If you need to turn control back over to the score, you need to unpuppet the sprite with the following Lingo: puppetSprite 1, false |
Previous versions of Director only supported one movie script. The movie script was something of a "master script" that overrode all other types of scripts and governed the playback of the entire movie. Director 5.0 lets you compose multiple movie scripts to give an added degree of flexibility. Movie scripts are written in the movie script window.
Movie scripts become cast members just like any other script, so after you create it, you can double-click its cast member to go back and edit it.
Movie scripts are available to the entire movie and are used to control events that should occur when a movie starts, stops, or pauses. An example movie script might look the following:
on startMovie global clickCounter set clickCounter = 0 end startMovie on stopMovie set the backColor of the stage to 0 end stopMovie
This script initializes a global variable clickCounter and sets it to zero when the movie begins. At the end of the movie, the script changes the stage's background color to black. Movie scripts are good for these types of "initialization at the beginning" and "cleanup at the end" tasks.
When you're happy with your movie, it's time to get it ready for the Web. There are three basic steps to accomplishing this, as follows:
Everyone knows how important it is to keep files small on the Web. Users with slow connections are likely to lose patience waiting for huge files to download. Graphics are one type of file that you need to keep small. Because of their complexity, Director movies need to be kept as small as possible as well. To help you achieve this, try some of these tips:
After making your movie as small as possible, you can save it using File, Save; File, Save As; or File, Save and Compact. The result of each of these is a file with the .Dir extension that contains your movie. A movie saved with File, Save and Compact is optimized to make the .Dir file as small as possible.
Afterburner is a utility program that compresses a Director movie further and gets it ready to go up on the Web. To use Afterburner, just double-click its icon and browse to the movie file it should compress. The result is a file of the same name, but with the .Dcr extension. This is the file that should be placed on your server.
Incorporating a movie into a Web page is just a matter of using the HTML <EMBED> tag. <EMBED> takes the SRC attribute to tell the browser where it can find the .Dcr file containing the movie and the WIDTH and HEIGHT attributes. A typical <EMBED> tag might look like the following:
<EMBED SRC="mainpage.dcr" WIDTH=580 HEIGHT=244>
When a browser enabled with the Shockwave plug-in sees this tag, it reserves a 580´244 pixel space, loads the movie, and plays it on-screen.
Macromedia has recently added streamed audio capability to Shockwave.
This feature lets the Shockwave browser plug-in play a sound as
it is downloaded, rather than downloading the entire sound file
and then going back and playing it. The Shockwave Audio (SWA)
family of products-Director 5, SoundEdit 16 plus Deck II, and
SWA compression Xtras-also enable you to compress audio files
at ratios as high as 176:1. This feature is invaluable when you
consider how important it is to keep download times to a minimum.
| NOTE |
The SWA compression Xtras for Director 5 and SoundEdit 16 are placed in the Director5 and SoundEdit 16 folders when you install Shockwave. |
| TIP |
Look for two template movies in your SWA examples directory. The "Player" movie is especially nice as it provides four different sound control interfaces for the user. |
The SWA Export Xtra for SoundEdit 16 is the key to creating streamed audio files. You'll find this as an option under SoundEdit 16's Xtras menu.
The most important step in creating a streamed audio file is selecting
the bit rate. Your choice here will impact how fast the audio
is streamed-a high bit rate produces a high streaming rate. The
bit rate also has an effect on sound quality. You might choose
a lower bit rate to slow down the streaming rate for users on
a slow connection, but that will reduce the quality of the sound.
Table 29.1 gives you some rules of thumb to use when making a
decision about bit rate selection.
| Speed of audience connection | Bit rate |
| T1 | 64Kbps-128Kbps |
| ISDN | 32Kbps-56Kbps |
| 28.8Kbps | 16Kbps |
| 14.4Kbps | 8Kbps |
| CAUTION |
If you choose a bit rate of 32Kbps or less, the SWA Export Xtra will automatically convert stereo files to mono. |
Compression of audio files is done from Director 5, not from SoundEdit 16. The choices you make when setting up the compression are similar to those made when creating a streamed file. You can use the rules of thumb in Table 29.1 when choosing bit rates for the compressed files as well.
It is important to understand that the Director 5 Compression Xtra doesn't actually perform the compression. You use the Xtra to configure the compression parameters. Once that is done, you need to use Afterburner to complete the compression.
To make a streamed audio file available to a Director movie, you should place the file on your Web server. Then, you can import the file from a Lingo movie script, like the following:
on startMovie set the URL of member "swafile" to "http://www.your_server.com/swa/greeting.swa" set the preLoadTime of member "swafile" to 10 end
The preload time specifies a number of seconds of audio to preload before starting to play the audio. Higher preload times can increase the time a user has to wait, but it will help ensure the integrity of files created with higher bit rates, especially over slower connections.
Macromedia has expanded Lingo to include elements that support
streamed audio files. Two of these are the URL and preLoadTime
elements you saw used in the script to preload a sound file. Some
of the other key additions are summarized in Table 29.2
| Command | Function |
| preLoadBuffer | Preloads a sound file into memory |
| Play | Commences playback of a sound file |
| Stop | Discontinues playback of sound file |
| Pause | Pauses playback of a sound file |
| the state of member "swafile" | Returns a value indicating that the file is stopped, preloading, preloaded, playing, or paused |
| the bitRate of member "swafile" | Returns the bit rate of a sound file |
| the percentPlayed of member "swafile" | Returns a percentage indicating how much of the movie has played |