This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
(paragraph), (bold), and (italic), which are used to lay out the document. Director does not recognize embedded objects other than tables. Director ignores the following features found in HTML documents: images, frames, input fields, and embedded applets. HTML documents can be imported locally or from the Web. Caution
Make sure you are using HTML text from a Web server that you know will always be online. Otherwise, the text in the linked cast member may not appear in your movie.
3486-6 ch04.f.qc
7/24/00
5:40 PM
Page 161
Chapter 4 ✦ Using Text in Director
If you select the Link to File option when importing an HTML document that is located on a Web server, the linked cast member in Director will automatically update when the source page on the Web server is updated, provided that the user has a working Internet connection when they play the movie. The user does not have go to the actual Web page for this to occur.
Note
Authors can now use external linked scripts that can be updated separately by another author. This is a very useful feature when working on large-scale Director projects that involve multiple programmers and authors. The supported file extensions for scripts are .txt or .ls, Director’s internal file extension for linked scripts. A linked script is updated only during the authoring stage of the movie’s development. A copy of the script is stored in the movie when it is output as a Projector or Shockwave file, thus avoiding the need to distribute the scripts with your movies. Director 8 now has the capability to import and link to external Lingo scripts.
New Feature
You import text files just as you do any other type of element, by choosing File ➪ Import, selecting the files that you want to import, and setting the options, such as linking. CrossReference
Director’s Import operations are discussed in detail in Chapter 2.
Embedding Fonts in Your Movie The best way to deal with the cross-platform font problems is to embed the desired fonts directly in your movie. When you embed a font in your movie, Director stores all of the font information so that the font can be displayed even if it is not installed on the user’s system. Embedded fonts appear in the Cast window, just like any other cast member, and are accessible from all of Director’s font menus. All of the text members you used in this chapter have had embedded fonts applied to them; the fonts appear on the Windows operating system the same way they appear on the Macintosh operating system that was used to create the movies for this book. Director compresses the fonts, which means that they will increase the size of your movie by an average of 15K to 25K. If file size is a concern, you can include just the characters used for the text. This option is useful if you are developing movies that will be played back over the Web. You can also include bitmap versions of the font for displaying text at sizes smaller than 12 points, where antialiasing can have a negative effect on the text. Note
There are no legal issues involved with distributing fonts that you embed in your movie, because they are available only to the movie itself and cannot be used in any other application.
161
3486-6 ch04.f.qc
162
7/24/00
5:40 PM
Page 162
Part I ✦ Working with Director
Embedding a font It’s a good idea to embed the fonts that you want to use in your movie before creating Text cast members that use them: 1. Choose Insert ➪ Media Element ➪ Font. In the Font Cast Member Properties dialog box that appears (see Figure 4-18), you can choose a font, select bold and italic versions of the font, and include specific bitmap sizes and characters.
Figure 4-18: In the Font Cast Member Properties dialog box, select the attributes of the font that you are embedding in your Director movie.
2. Select the font by clicking the arrow button next to the Original Font list box. A list appears, showing all the fonts installed on your system. Choose the font that you want to use from this list. 3. In the New Font Name box, the name of the new font appears followed by an asterisk. Director uses this new name in all of its font menus. It’s better to use the default name for the font, because it is more obvious than its embedded version. Here are some things that you should consider before selecting the other options: ✦ If you want to have bold or italic versions of the font (which are more attractive), click the check boxes to turn these options on. Selecting these options includes a bitmap version of the bold and italic characters of the font, which increases the size of the Font cast member.
3486-6 ch04.f.qc
7/24/00
5:40 PM
Page 163
Chapter 4 ✦ Using Text in Director
✦ To include bitmap versions of the font at specific sizes, click the Sizes radio button below the Bitmaps options and type in the sizes that you want to use, separated by either spaces or commas. Select this option if you will be displaying small text sizes that won’t look good if they are antialiased. ✦ If file size is a concern, add only the characters that you are using for the text. Click the Partial Set radio button below the Characters option. Choose to include Punctuation, Numbers, and Roman Characters, and type in any individual characters that you want to include. Tip
If you are developing Director projects simultaneously on both the Windows and Macintosh platforms, using embedded fonts enables you to open and edit Text and Text Field cast members without losing their font attributes, even if the font is not installed on the user’s system.
Summary This chapter explained some of Director’s powerful text-handling capabilities. Among the topics discussed were these: ✦ Director supports three types of text: bitmapped text, RTF (Rich Text Format), and text fields. ✦ You can embed fonts in a movie, and you can apply embedded fonts to Text and Text Field cast members. Using embedded fonts ensures that the text will be displayed and edited correctly on any platform, even if the font is not installed on the user’s system. ✦ Rich Text can be antialiased, enabling you to remove or reduce the “jaggies” effect that often occurs with bitmapped text. ✦ You can flip, rotate, skew, and animate Text cast members in the same way that you perform those operations on a bitmapped cast member. ✦ HTML documents can be imported into Director and when imported, they retain their original formatting and hypertext links. ✦ Lingo scripts can be linked as external files that are automatically updated when the script is revised. ✦ You can edit the properties that determine the way text is displayed (if the text is editable), and you can change how the Tab key affects the Text cast member. The next chapter describes how to use sound in your Director movies.
✦
✦
✦
163
3486-6 ch04.f.qc
7/24/00
5:40 PM
Page 164
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 165
5
C H A P T E R
Using Sound
S
ounds add another dimension — an important one — to Director movies. Aside from putting dazzle into your movie, sounds fulfill a key concept of multimedia: to provide information in a format that maximizes the impact of the presentation. Multimedia is a multisensual method of relaying information to an audience. Whether you are creating a simple animated cartoon sequence or an elaborate interactive application, you essentially are teaching your audience about the topic of your movie. The mechanisms of learning are complex, but one simple axiom is always true: The more ways you present information, the better your chance of reaching your audience with positive results. Director supports a variety of digitized sound file formats that you can use to enhance your movies. In this chapter, you learn how to choose a sound format. You also learn the basics of importing and editing sounds for Director movies. When you understand sound theory and how Director deals with sound files, you have taken an important step toward using sound effectively with your audience in mind.
Sound Basics Sounds can take a movie from the mundane to the spectacular. They can inform, guide, and stimulate the interest of the user. Understanding Director sound basics provides the foundation you need for using sounds creatively and efficiently in your movies: Two key concepts should be behind every audio decision you make when working with Director and sounds: ✦ The first concept is to remember your audience. A sound should enhance the movie while balancing the needs and resources of the user.
✦
✦
✦
✦
In This Chapter Importing sounds into movies Digitized sound formats Adding sounds to your movies Editing sounds outside of Director File sizes and sampling considerations Using and editing sounds efficiently Working with sound Xtras
✦
✦
✦
✦
3486-6 ch05.f.qc
166
7/24/00
5:41 PM
Page 166
Part I ✦ Working with Director
✦ The second concept is actually more than that; it’s a law. Two types of files can bring a computer to its knees in nearly the blink of an eye: complex graphics files and sound files. Sound files can be huge, requiring significant resources to store and play them. Therefore, the law is to choose and edit sounds carefully, to balance creativity and file size. This section discusses importing sounds. It also discusses the difference between internal and external sounds, helps you choose among sound formats, and explains how you can edit sounds externally.
Importing sounds As the author of a Director movie, you need to make a number of decisions regarding a series of issues that affect the final movie. One issue, as already mentioned, is your audience. The audience is especially critical if your movie will contain sounds. Your audience may not have the system resources that you have, and thus balancing file size and quality factors with the goals of your movie becomes essential to the movie’s success. In selecting sounds for your project, you need to consider three factors: file format, sampling rate, and file compression. If you are developing a movie designed for both PC and Macintosh platforms, you can save a significant amount of time if you consider file format before creating the movie. Choosing a sound format supported by both platforms is one way of ensuring that you don’t need to create the movie twice. As your movies grow in size, finding individual sprites and cast members when you want them can become a tedious task. It’s easy to miss a single cast member and cause your movie to fail, especially if you must swap a number of cast members to conform to a specific platform. When you choose a sound for use in a Director movie, you should also be aware of the sampling rate and file compression. The basics of importing a sound file into Director are the same regardless of the sound format you choose. When you import a sound file into Director, it becomes a cast member that you can place in the Effects section of the Score. Unlike other types of cast members, sound cast members aren’t placed on the Stage.
Importing a Sound File into Director On the CD-ROM
The companion CD-ROM has several sound files that you can import into your movie and that you can use for the exercises in this chapter. They are found in the EXERCISE:CH05:AUDIO (EXERCISE\CH05\AUDIO) folder. This collection of sounds, generously provided by Jay Shaffer (copyright 2000 Zenapse), was downloaded from the Zenapse Web site at http://www.zenten.com/zenten.
1. Choose File ➪ Import or press Command+R (Ctrl+R) to display the Import Files dialog box (see Figure 5-1).
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 167
Chapter 5 ✦ Using Sound
Figure 5-1: Use the Import Files dialog box to select sound files and add them as cast members.
2. Choose the folder that contains the sound file that you want to import into Director, and then select the file. You can select multiple files by pressing the Shift key while clicking the files. Click Add to move the selected filenames into the File List. 3. Click the Media Option menu at the bottom of the window. From the pop-up list, choose Include Original Data for Editing if you want to use an external sound editor. This option enables you to quickly edit and update the sound in your movie, by launching the external editor when you double-click the cast member. 4. When you have selected all the files you want to import and added them to the File List, click the Import button to complete the operation and return to the Director window. The sound files you selected appear in the Cast window.
Using internal versus external sounds Internal and external sounds are stored differently, and managed differently by Director as well. When you import a sound into Director, it’s placed in the cast and considered an internal sound. (The cast member can be either an internal or external cast.) The sound information is saved with the cast or movie, which also increases the file size of the movie. External sounds, on the other hand, are linked by Director, which enables you to store the sound file separately from the movie, thereby reducing the movie’s file size.
167
3486-6 ch05.f.qc
168
7/24/00
5:41 PM
Page 168
Part I ✦ Working with Director
OLE and sound files: A bad match Director supports OLE functions. OLE (Object Linking and Embedding) is a difficult concept for many people, but it’s not as complicated as it seems. OLE enables you to easily share and edit elements between two OLE-compliant applications, without having to worry about import and export filters. The shared objects are transferred via the Windows Clipboard, from one application (known as the server application) to another application (the client application). OLE is primarily a Windows function, although a Mac OLE SDK (Software Developers Kit) exists and can be used to add OLE functions to Macintosh applications. When you use OLE, you can choose to either link or embed the object in the client application. Linking the element means that the element is stored separately from its associated document. Every time you open the associated document, the application searches for the object and moves it into the document. So, if you change the object, it will be updated when it appears in the client application. Embedding an object means it’s stored with the receiving document and isn’t updated each time you open that document. Both linking and embedding enable you to quickly edit the object and return to your document. It’s important to understand that OLE is designed to transfer text and graphics — not sounds — between applications. Director sees every OLE object, text and graphics both, in terms of a bitmap. OLE is not intended for the transfer of sound files, and sounds may become corrupted if this method is used to place them in documents. Some OLEcompliant graphics applications include sound editors, but you should never use OLE to place these files.
Tip
Consider storing large sound files in linked external casts. Doing so enables the sound to stream and reduces the file size of your movie.
Director preloads internal sounds into RAM before playing them. Although this works well for small sound files such as beeps, storing larger music sound files internally can cause a lag in the movie. External sound files are streamed, which means that they start playing while the rest of the file is loading. The drawback to external sound files is that if you move the sound file to another location, the link is broken and must be reestablished before the sound will play in your movie. Tip
Creating a folder to contain all the elements of your movie can save you a lot of grief when it’s time to output the movie. When files are stored using this method, all the files required for the movie are in the same location, which reduces the risk of losing a critical file. This storage method also reduces the amount of time it takes for Director to search for a specific file.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 169
Chapter 5 ✦ Using Sound
Choosing a sound format Another audience issue when you’re working with sound files concerns resources. Sound file sizes typically range from large to humongous. These large files can bloat your movie, causing longer load times. And if the end-user has a system with limited resources, these files can cause the movie to crash. The choice of file format is, therefore, an important one. Director supports AIFF (Audio Interchange File Format) and WAV (Waveform Audio File) sounds, AU (Sun Audio), MP3 (MPEG 1 layer 3), SWA (Shockwave Audio), QuickTime Audio for Windows and the Macintosh, as well as Macintosh System 7 sounds. Director also supports RMF (Rich Music Format) files using the Beatnik Xtra by Headspace, although the files cannot be imported into the Cast window and must be controlled with Lingo. Use the following information to choose a sound format: ✦ WAV Files: WAV sound files are primarily Windows files, although they can be imported on the Macintosh platform also. Director supports WAV files compressed with IMA-ADPCM compression (Interactive Multimedia Association — Adaptive Differential Pulse Code Modulation). Be aware, however, that any compressed file must be decompressed (expanded) before it can be used. Compressed files are good for storage purposes, but they can take longer to load. ✦ AIFF Files: Although they don’t support compression, AIFF files have the advantage of being multiplatform. Both PCs and Macintosh machines can play AIFF sound files. This format is not a native format for the PC, but Director and a variety of other programs support AIFF on the PC without the use of external software. ✦ AU Files: This is a common sound format that is used on Unix workstations. Unless you are building scientific applications, you probably will not encounter this format. ✦ MP3 Files: Director supports files that are compressed using the MPEG 1 layer 3 compression. MP3 compression requires a lot of processor time to decompress. The MP3 format has exploded onto the scene within the last year, and there are now many sources for MP3 audio on the Internet. Caution
Just because an MP3 file is available for listening, does not mean that you have the right to use it in your multimedia application. Make sure that you have the author’s permission before using any MP3 audio files.
✦ QuickTime Audio: Digital QuickTime movies that contain only audio can be used in Director. They are imported and treated as any other QuickTime digital video cast member. To use QuickTime audio in your movies, QuickTime extensions must be present on the computer playing the audio file. Chapter 6 covers QuickTime digital video in detail.
169
3486-6 ch05.f.qc
170
7/24/00
5:41 PM
Page 170
Part I ✦ Working with Director
✦ Macintosh System 7 Files: If you are creating your movie on a Macintosh, you can record sounds from within Director by choosing Insert ➪ Media Element ➪ Sound. You need to have an audio input or microphone connected to your Macintosh. This feature is for Macintosh only, and it is not supported in the Windows version of Director. ✦ Shockwave Audio (SWA): Shockwave Audio files can be compressed up to a ratio of 176:1, and they can be streamed as well. You first need to use Director to create Shockwave Audio files from another type of audio file. You then can import or link the Shockwave Audio files to your movies. Creating Shockwave Audio files is covered in the “Working with Sound Xtras” section of this chapter. ✦ Rich Music Format (RMF): Using the Beatnik Xtra and Lingo, you can incorporate RMF files into your movie. RMF files take up very little disk space, yet they deliver outstanding audio quality. Rich Music Format files play back on both the Windows and Macintosh platforms as long as the Beatnik Xtra is installed on the user’s system or delivered with the movie. The drawback to using RMF files is that they can’t be imported into the Cast window and used in the sound channel like other audio files. Considering the small file size and amazing sound quality that this format provides, it’s worth taking the time to learn how to use RMF files. Chapter 18 explores Beatnik Xtra in more detail. Regardless of the chosen format, you need the assistance of a good sound editor to adjust the length and effects within your sound file. Optimizing sounds within your sound editor can help keep the file size small without compromising the quality of your movie.
Editing sounds externally Director doesn’t provide the capability to edit sounds within the program. Director does enable you to specify an audio-editing application in the program’s preferences, however. After you’ve specified an application, you can edit a selected sound cast member by choosing Edit ➪ Launch External Editor or by doubleclicking the cast member in the Cast window.
Specifying an External Sound Editor 1. Choose File ➪ Preferences ➪ Editors to display the Editors Preferences dialog box (see Figure 5-2). 2. Scroll through the list to choose the type of sound file for which you want to select an editor. In this example, the WAVE file type is selected.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 171
Chapter 5 ✦ Using Sound
Figure 5-2: The Editors Preferences dialog box enables you to select an external editor for your sound files.
3. Click the Edit button. The next dialog box displayed reflects your choice of file type in the title bar; in this example, you see the Selected Editor for WAVE Sound dialog box (see Figure 5-3).
Figure 5-3: The Select Editor for WAVE Sound dialog box enables you to specify the application to use for editing your sound files.
4. Click the Browse button and then locate the audio-editing application on your hard drive. Select it, and it appears in the list window. Click Open to accept this choice. Click OK to close the Select Editor dialog box and return to the Editors Preferences dialog box. 5. If you want to select more than one sound-editing application, repeat Steps 2 through 4. If you select more than one application at this time, you will have to specify which one you want to be the active editor for your movie by highlighting the name. When you are satisfied with the settings, click OK to return to Director’s main window.
171
3486-6 ch05.f.qc
172
7/24/00
5:41 PM
Page 172
Part I ✦ Working with Director
Choosing a sound-editing application provides you with a quick bridge for editing your sound files. Instead of exiting Director and opening another program, you can simply launch the external editor from within Director. In addition, the changes you make are automatically incorporated into your movie, which reduces the need to delete and reimport cast members. Note
The Director 8 Studio includes a sound-editing program. If you are using the Windows version, the sound-editing program is Sonic Foundry’s Sound Forge XP4. The Macintosh version uses BIAS Peak LE as its sound editor.
Sampling rates, recording modes, and other issues Understanding a bit about a sound’s file size and quality will help you when you’re using an audio-editing application to process audio files for your movies. Factors that affect the size of a sound file are the sampling rate, recording mode (stereo or mono), bit depth, and compression method. It’s a good idea to choose the highest sampling rate possible when recording the original audio, and then sample it down later on in the editing process. The sampling rate is the frequency at which a sound is converted to digital format. A sampling rate of 44.1kHz, for example, means that the sound is sampled 44,100 times each second the sound lasts. In most cases, a sampling rate of 11.025kHz is good for voice recording, and 22.05kHz is fine for music-quality recording. Higher sampling rates result in a better recording. If you want to have a CD-quality recording, use a 44.1kHz sampling rate. Tip
Not all of the audio used in your movies needs to use the same settings. Rarely does a voiceover segment need to have CD audio quality. On the other hand, you might want a music soundtrack to be full stereo and sampled at CD quality. Carefully determining the needs for each segment of audio will help your movies sound more professional and yet stay within a reasonable file size.
Choosing mono recording mode rather than stereo is another way to yield a smaller file. Mono recording mode uses a single channel for the sampling, whereas stereo mode uses two channels to improve the quality of the sound. Figure 5-4 shows the same WAV file in both a stereo and a mono format, as represented in an audio editor. Note
A mono audio file is half the size of a stereo file at the same sampling rate.
Sounds are frequently resampled from 16-bit to 8-bit to save storage space. Typically, 8-bit sounds are lossy, which means information is lost in the translation from a higher bit depth, resulting in a poorer sound quality. If your sound editor supports the removal of silent bits of information and dynamic compression, you can edit a
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 173
Chapter 5 ✦ Using Sound
16-bit file prior to converting it to 8-bit. This editing improves the quality of the sound when it’s resampled to 8-bit. (For more information, see the documentation for your sound editor.)
Mono (one channel)
Stereo (two channels) Figure 5-4: Stereo and mono sounds represented in an audio editor Tip
You might find that 8-bit samples are noisier than 16-bit samples. You can get better quality if you lower the sampling rate from 22.5 kHz to 11.25 kHz and use a 16-bit sample, than if you use an 8-bit sound sampled at 22.5 kHz — even though the file size is approximately the same.
Table 5-1 compares the file sizes that result when applying various sampling rates and recording modes to a sound file in the humongous range. I chose a 74-second file for comparison because the differences between the file sizes were so dramatic; most sound files aren’t this long. Looping sound enables you to give the illusion of a longer sound file without straining the resources of a computer (see “Looping Sounds,” later in this chapter).
173
3486-6 ch05.f.qc
174
7/24/00
5:41 PM
Page 174
Part I ✦ Working with Director
Table 5-1 File Size Comparison for Different Sampling Rates/Recording Modes Sampling Rate
16-Bit Stereo
16-Bit Mono
8-Bit Stereo
8-Bit Mono
44.1 kHz with compression; WAV file format
3.15MB
1.57MB
1.57MB
812K
22.5 kHz with compression; WAV file format
1.58MB
812K
812K
412K
11.25 kHz with compression; WAV file format
818K
412K
412K
376K
44.1 kHz WAV file format
12.5MB
6.29MB
6.29MB
3.14MB
22.5 kHz WAV file format
6.29MB
3.14MB
3.14MB
1.57MB
11.25 kHz WAV file format
3.14MB
1.57MB
1.57MB
805K
44.1 kHz AIFF file format (AIFF does not support compression)
17.9MB
8.95MB
8.95MB
4.47MB
Obtaining sounds for your movies The first step in obtaining sounds for your movies is to determine the type of sound files you need. Some multimedia projects require voiceovers; others require specialeffects sounds (SFX), such as a bell or thunder. On the CD-ROM
Several demos from audio providers are on the CD-ROM. One of our favorites is a demo from Rarefaction, which makes a series of music and effects CD-ROMs called A Poke in the Ear.
If your sound card supports audio input, you can record your own sounds, either by using a microphone directly connected to your sound card or by transferring sounds from tape to your computer. You can find a variety of sound sources on the World Wide Web and through companies that market sound clips. Some of these sound files are considered public domain, which means that you can use them freely. Others are protected by copyright laws and licensing agreements. If you have questions regarding these laws, the licensing information for a particular sound file, or both, contact the source before including the sound file in any project. Tip
If you are creating movies on the Macintosh, you can record sounds directly into Director by choosing Insert ➪ Media Element ➪ Sound. In the Macintosh Sound Recording dialog box that opens, record the sound by using the built-in microphone. Unfortunately, this feature is not available to Windows users.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 175
Chapter 5 ✦ Using Sound
With a clear idea of what you need and a little research into the available sources, you can incorporate any sound you can imagine into your project. Audio files can quickly consume gigabytes of hard drive disk space. If you’re using large amounts of audio for your movie, we suggest that you avoid recording directly to your computer. It’s far better to record to high-quality tape and then transfer the sounds to your computer as you need them.
Tip
Adding and Editing Sounds One of this book’s authors was in a situation in which he had less than two days to create an animation sequence of an alien being interviewed by a reporter. Given the tight deadline, he had to create the animation of the alien talking before the voiceover was recorded. Because he couldn’t add the audio track until the very last minute, having the alien’s mouth move in sync with the audio would have been almost impossible to pull off successfully. To solve the problem, he had the alien talk telepathically, indicated by a forehead wrinkle that moved when the alien spoke. This technique enabled him to rough-in the animation before the voice-over track was recorded and digitized, and then make minor adjustments to the movie after the audio files were imported into Director. This trick saved a lot of time and turned out to be a very comical effect. Sure, none of this was terribly complicated, but it required time and a little creative ingenuity. It also required knowing how to manage a sound and use sound channels after the sound was imported into the movie.
Placing sounds in the Score After your sounds have been imported as cast members, you are ready to place them in your movie. On the CD-ROM
The companion CD-ROM has several sound files that you can import into your movie for this exercise. You can find them in the EXERCISE:CH05:AUDIO (EXERCISE\CH05\AUDIO) folder.
Placing a Sound Cast Member in the Score 1. Start by opening the movie into which you want to place a sound. 2. Director enables you to hide or show the Effects channels in the Score (by default, they’re hidden). To turn the Effects channels off and on, click the Hide/ Show Effects Channels button in the Score window, as shown in Figure 5-5.
175
3486-6 ch05.f.qc
176
7/24/00
5:41 PM
Page 176
Part I ✦ Working with Director
Figure 5-5: Click the Hide/Show Effects Channels button to display or hide the effects channels.
3. In one of the sound channels, click the location where you want the sound to start. Note
The Score displays two channels for sound. Although Windows technically supports only one, Director supports multiple sound channels and enables you to place sounds in both of the visible sound channels in the Score, which is accomplished by mixing the two sound channels together to produce a single channel on Windows-based machines. Additional channels beyond the visible two are accessible only through Lingo or via digital video.
4. Drag the sound cast member from the Cast window to the location you selected in the Score (see Figure 5-6). When you release the mouse button, the sound cast member appears in the Score in the location you selected. Alternatively, you can drag the sound cast member to the Stage. Although Director cannot place sound members on the Stage, it automatically places the sound in the first available sound channel of the Score for the current frame, and it becomes a sound sprite.
Figure 5-6: The sound cast member appears in the sound channel at the location you specified in the Score.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 177
Chapter 5 ✦ Using Sound
When you create a new sound sprite, Director assigns it a default length (28 frames). You may need to adjust the length of an individual sprite (by extending it in the Score) to ensure that the sound plays completely. If you find that this situation occurs frequently, you may want to adjust the Span Duration amount in the Sprite Preferences dialog box (choose File ➪ Preferences ➪ Sprite), so that you aren’t constantly having to change the length of sprites.
Changing the Default Length for Sprites 1. Choose File ➪ Preferences ➪ Sprite to display the Sprite Preferences dialog box (see Figure 5-7). 2. In the Span Duration section of the dialog box, enter a new value in the Frames field. 3. Click OK to return to Director’s main window.
Figure 5-7: Adjusting the default sprite length
Setting a default length for sprites is a good policy, but any given cast member may require more or fewer frames.
Adjusting the Length of Individual Sound Sprites 1. In the Score window, drag the last frame of the sound sprite you want to adjust. To make the sound sprite longer, drag to the right, as shown in Figure 5-8; to make the sprite shorter, drag to the left. As you drag, you can see the sound sprite extending or contracting in length. 2. Rewind the movie and play it. Continue adjusting in the same way until you are satisfied with the length of the sound. Tip
To keep your movie compact, adjust the frame length of sprites to a sufficient length, but no more than what is required to achieve the desired effect.
177
3486-6 ch05.f.qc
178
7/24/00
5:41 PM
Page 178
Part I ✦ Working with Director
Figure 5-8: Adjust the length of a sprite by dragging the end of the sprite. Note
You can also set a tempo statement to force the movie to wait until a sound finishes playing (see “Using Cue Points in a Movie” later in this chapter).
Using channels effectively Director doesn’t limit you to playing a single sound at a time. Director displays two sound channels for your use. You can play two sounds at the same time; in addition, you can add more sound channels by using Lingo commands (see Chapter 18). Playing multiple sounds is useful if you are creating a complex multimedia project and need to gather a variety of sounds. For example, in a movie about a jungle expedition, you might want sounds of birds, animals, people talking, and native drums. It would be difficult to pull all those sounds together into a single audio file. You can have all those sounds by alternating sounds in Director’s two sound channels. Look at the two sound channels in Figure 5-9. The sound sprite in channel 1 is ambient background noise (an alien spacecraft in this instance). The sound sprites in channel 2 are voice-overs that provide information about the current activity in the movie. What you can’t see is the editing that coordinates the sounds in both channels. The background noise becomes softer when the sprite in channel 1 is playing; it becomes louder when channel 1 is silent. Director doesn’t have an independent capability to alter the volume of a single channel without using Lingo. The volume editing for this example was done in an external sound editor. In addition to volume changes, you can add other mixing effects, such as echoes and fades. By carefully editing your sound files, you can customize the sounds to fit the mood or theme of your movie.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 179
Chapter 5 ✦ Using Sound
Figure 5-9: Using both sound channels, you can simultaneously play two sounds in your movie.
Managing Sounds Adding sound to a short and simple movie is a process of simply dragging the sound cast member to the Score. The sound starts to play when the playhead reaches the beginning frame of the sound, and the sound plays to the end of its allotted number of frames. But what happens when your movies become more complex and lengthy, containing several sounds and not just one or two? Managing these sounds involves several tasks: You control when a sound plays, whether it repeats, and whether the movie pauses for the sound. Good sound management not only enhances your movie, but it also can be critical to the success of your multimedia applications. New Feature
Director 8 introduces several new Lingo commands that expand Director’s audio playback capabilities. These commands give greater control over various aspects of creating a movie, such as looping, transport, cue points, panning, and crossfading. Chapter 18 discusses these new commands.
179
3486-6 ch05.f.qc
180
7/24/00
5:41 PM
Page 180
Part I ✦ Working with Director
Using cue points in a movie Director makes it easy to control the pace of your movie by using cue points in audio files. You use cue points to mark a position at which you want an event to occur in a digital audio or digital video file. In Windows, you can use either SoundForge XP4 or CoolEdit; on the Macintosh, you can use either BIAS Peak LE or SoundEdit 16 to place cue points in audio and digital video files. Suppose that you want to create an animated tour of an art museum. Adding narration at each stop on the tour would enhance the movie enormously. By placing cue points in the voice-over, you can pause the playback head at a specified frame that displays an exhibit in the museum, until the voice-over has finished giving the information about that exhibit. When the cue point is reached, the movie continues to the next frame or exhibit. The cue points ensure that the timing for each scene in the movie matches the voice-over.
Incorporating Cue Points On the CD-ROM
In this exercise, you can use the cuepoint.dir file found on the companion CD-ROM in the EXERCISE:CH05 (EXERCISE\CH05) folder.
1. Open the cuepoint.dir movie in Director. The sound file called idunno has already been imported and placed into the movie. This audio file contains four cue points that were added before importing it into the movie. 2. There are four markers in the movie. Although it’s not necessary to use them, markers make it easier to determine the exact spot in the movie where you want to add the cue point (see Figure 5-10).
Figure 5-10: Adding markers to indicate where to add cue points makes it easier to organize your animation.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 181
Chapter 5 ✦ Using Sound
3. Double-click frame 10 — identified by a marker labeled add percussion — in the tempo channel. The Frame Properties: Tempo dialog box appears, as shown in Figure 5-11.
Figure 5-11: Specifying the pause to wait for a cue point
4. Click the Wait for Cue Point option. 5. Open the Channel list and select the sound file. 6. In the Cue Point list, select the cue point named Add percussion. 7. Repeat Steps 3 through 6 for the Add synth and Begin fade markers. The cue points in the audio file have the same name as the markers. 8. Rewind the movie and play it back with the Score window open. The playback head advances until it hits a cue point; it then waits until the audio file reaches that cue point, and then it continues to advance until it reaches another wait for cue point command. Note
If the frame does not include a sound file with cue points, the only option on the Cue Point pop-up list is {No Cue Points}.
Tempo, sounds, and interactivity Director enables you to place interactive elements, such as forms, buttons, and other effects, in your movies. It’s important to remember that once a sound begins to play, it plays to the end of its allotted frames. This can cause a conflict with interactive elements, such as a sound attached to a button. Although you can’t stop the sound (except through the use of Lingo), you can control the other sprites and elements of your movie. You can avoid conflicts between sound, tempo, and interactivity by using Lingo commands to play the sounds. (Methods for using Lingo to control interactivity, sound, and animation are discussed in the Lingo portion of this book.)
181
3486-6 ch05.f.qc
182
7/24/00
5:41 PM
Page 182
Part I ✦ Working with Director
Caution
It’s a good idea to avoid using the same frame for a sound or digital video cast member and several other effects sprites. The sound or digital video can take control of the movie, and it’s difficult to predict the order in which the other effects will play. In addition to the problem of playing order, this arrangement can cause a brief but critical hit on the resources of low-end computers. To alleviate this conflict, duplicate the frame and specify a different effect for each frame; this helps you control the playing order and manage resources — without memory or effects conflicts.
Looping sounds You can get a lot of mileage out of very small and brief sound files. Many of the sounds around us are repetitive: the roar of thunder, the pounding of surf, footsteps, a ringing bell, the din of city traffic, a murmuring crowd. With some careful editing, together with Director’s capability to loop sound, you can add sounds without significantly increasing the file size of your movie. Director offers you two non-Lingo methods of repeating a sound. You can specify that you want just the sound to loop, or you can include the sound in a film loop. On the CD-ROM
For the next exercise, you can import any of the audio files that begin with the word loop that are located on the CD-ROM in the EXERCISE:CH05:AUDIO (EXERCISE\CH05\AUDIO) folder.
Setting a Sound to Loop 1. In the Cast window, select the sound that you want to loop. 2. Click the Properties button in the Cast window to activate the Property Inspector. You may need to click on the Sound tab to activate the Sound Properties window (see Figure 5-12).
List view toggle button
Play/Stop buttons
Figure 5-12: Setting a sound to loop
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 183
Chapter 5 ✦ Using Sound
3. Mark the Loop check box, and click the Play button to hear the sound loop. Whenever you use this cast member in a movie, it will loop. Note
The sound playback function is available only in the Normal View mode of the Property Inspector. If you are in List View mode, click the View Mode toggle button to switch to the Normal View mode.
Caution
If you are placing the member into a sound channel, you need to make sure that it spans enough frames to play the entire sound. Otherwise, it will sound clipped (cut off).
Looping sound is an effective means of getting the most from small sound files. If your sound is coordinated with a specific animation sequence, consider including the sound in a film loop with the animation. In the next exercise, you add a sound file to a graphic animation sequence created by using the Cast to Time command to create a film loop that contains both graphics and audio. CrossReference
Chapter 3 discusses using the Cast to Time command for animating and creating film loops.
Including a Sound in a Film Loop On the CD-ROM
Use the movie called orb.dir on the CD-ROM for the following EXERCISE:CH05 (EXERCISE\CH05).
1. Open the orb.dir movie in Director, and then open the Cast window by choosing Window ➪ Cast or by pressing Command+3 (Ctrl+3). 2. Select the cast member named Drone sound and drag it into sound channel 1 of the Score window so that it begins in frame 1. Then click the tail of the sprite and drag it to frame 10 (see Figure 5-13).
Figure 5-13: Drag the tail of the Drone sound sprite to frame 10.
183
3486-6 ch05.f.qc
184
7/24/00
5:41 PM
Page 184
Part I ✦ Working with Director
3. In the Cast window, click the cast member named orb01, and then hold down the Shift key and click the cast member named orb10. Choose Modify ➪ Cast to Time to insert the cast members into the movie as a single sprite. 4. In the Score window, make sure the orb01 sprite starts in frame 1. If it does not start in frame 1, drag the sprite so that it begins in frame 1, click the drone sound sprite in sound channel 1, and then press the Shift key and select the orb sprite in sprite channel, 1 as shown in Figure 5-14.
Figure 5-14: Select the sound and sprites that you want to use for the film loop.
5. Choose Insert ➪ Film Loop to create the film loop. Give the film loop a meaningful name, and then click OK; the loop appears in the Cast window. After you’ve created the film loop, you can delete the selected sprites from the Score (but not from the cast). 6. Drag the film loop from the Cast window to the Score and place it in a sprite channel. 7. Open the Control Panel by choosing Window ➪ Control Panel or by pressing Command+2 (Ctrl+2). Set the playback to loop. Rewind your movie and play it. 8. You can add keyframes and tween the film loop to have the sprite move around the Stage. (If you are unfamiliar with these techniques, refer to Chapter 3 for detailed instructions.) Tip
You can’t create a film loop with only sounds. You must include other sprites or the Loop option will be unavailable. However, you can create a shape with the Floating Tool Palette that has no fill or outline and use it as the sprite.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 185
Chapter 5 ✦ Using Sound
Back doors to sounds Earlier in this chapter, we stated that without Lingo you are restricted to using the two visible sound channels to play one sound each. That’s not exactly true. You can trick Director into playing more sounds — by using film loops that contain a different sound in each loop. This technique enables you to have a unique sound in each film loop, and one in each of the sound channels. The only limitation to this trick is the availability of resources. In fact, this “back door” technique is problematic for systems with limited resources. If you include a digital video in a film loop, the sound attached to the video is disabled. The animation, however, isn’t disabled.
Setting the volume for a movie Director enables you to set the volume for your movie and save the volume settings both with the file and when the movie goes to distribution. As mentioned earlier in this chapter, you can’t control the volume of individual elements such as sounds or digital videos within your movie without using Lingo or a behavior. CrossReference
Chapter 18 discusses controlling sound with Lingo.
When you set the volume of a movie, it’s important to remember that computers respond differently to volume settings. You cannot determine the volume levels that are set for a user’s computer. It’s a good idea to set the volume settings in the medium range, and to assume that users will adjust the volume to suit their computers and their individual tastes. You can set the volume of your movie by using the Control Panel or the Volume command: ✦ If you choose Control ➪ Volume, select a volume level from the pop-up menu. ✦ If you use the Control Panel, click the Volume button and choose a volume level from the pop-up menu (see Figure 5-15). Tip
When choosing a volume level, it’s a good idea to take into account any sound editing that you’ve done. The idea is to keep the median sound level consistent (with the exception of fades and effects). Your movie will have less impact if the volume is constantly changing.
185
3486-6 ch05.f.qc
186
7/24/00
5:41 PM
Page 186
Part I ✦ Working with Director
Figure 5-15: Click the Control Panel’s Volume button to select a volume for your movie.
Working with Sound Xtras If you read Chapter 1, you already know a little about Xtras — small plug-in applications or scripts that enhance movies and expedite production by performing a series of tasks related to the selected sprite, frame, cast member, or movie. Xtras may come from a third-party developer or from Macromedia. Director includes a variety of Xtras for your use, such as Behaviors, Shockwave Audio (SWA), and Beatnik Lite. If you are a programmer, you can also develop your own Xtras for use with your movies. CrossReference
For more coverage of Xtras, see Chapter 26.
Using Shockwave Audio (SWA) Director’s built-in compression method for audio is called Shockwave Audio (SWA). The SWA Xtra compresses both internal and external sound files, yielding much smaller file sizes than other compression routines. Caution
Shockwave Audio will not compress MP3 or SWA files.
You can use Shockwave Audio to compress sound files to be used for the Internet and on disk: ✦ External sound files can be streamed. Streaming means that the sound file begins to play as it is downloading. Users don’t have to wait for the entire file to load before hearing sound. Streaming can be critical to the success of a Director project on the Internet, where you need to be conscious of file sizes and download times. Shockwave Audio will not stream sounds compressed at values lower than 16Kbps (kilobits per second). ✦ Although internal sounds can’t be streamed, you can still enjoy a good rate of compression without degradation of quality. When you specify Shockwave Audio settings for internal sounds, all of the sounds are compressed. You can’t compress some sound files and not others.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 187
Chapter 5 ✦ Using Sound
Shockwave Audio works only with compressed Director movies. Although you can specify compression settings at any time during the creation process, they actually don’t take effect until you compress the movie by creating a projector or a Shockwave movie, or by using the Update Movies command. When you distribute a movie compressed using Shockwave Audio, you must include the Xtras to decompress and play the sound. Generally, this is automatic, but it’s a good idea to make sure that you distribute all the associated files with your movie.
Note
Understanding Shockwave compression Shockwave Audio enables you to compress sound files up to a 176:1 ratio, which creates a much smaller file than other sound formats. The bit-rate scheme used by SWA is not related to the bit rate used to sample sound files; instead, it is related to the speed of transmission. Therefore, the higher the compression rate, the faster the download, the decompression, and the playing of the sound. Remember that some degradation of the sound quality occurs, as it does with most compression. SWA technology, however, changes the file as little as possible to achieve the desired compression. It’s a good idea to try a variety of compression values and check the quality of the sound. Then choose the best quality that balances the type of sound, movie, and distribution you intend to use. For example, a voice-over doesn’t require the same quality needed for music, and it can be compressed safely at a lower rate, between 8Kbps and 16Kbps transfer rate. Table 5-2 shows the optimum compression ranges for Internet use. These rates are not for the user, but rather on the server end, for delivery.
Table 5-2 Optimum Shockwave Audio Compression Ranges
Note
Delivery System
Compression Bit Rate
Quality Capability
T1
64 Kbps to 128 Kbps
Extremely high quality
ISDN or CD-ROM
32 Kbps to 56 Kbps
FM stereo to CD quality
28.8 modem
16 Kbps
FM mono or AM quality
14.4 modem
8 Kbps
Telephone quality
Director automatically converts any file with a compression rate below 48Kbps to monaural.
187
3486-6 ch05.f.qc
188
7/24/00
5:41 PM
Page 188
Part I ✦ Working with Director
In the next exercise, you learn to compress the audio files in your movies, using Shockwave Audio. In previous versions of the program, this operation was located under the Xtra’s menu. In Director 8, you choose File ➪ Publish Settings to find this operation.
New Feature
Compressing Internal Shockwave Sound Cast Members 1. Choose File ➪ Publish Settings, and then click the Compression tab to display the Shockwave Audio settings section (see Figure 5-16). Figure 5-16: Specifying compression settings for internal sound cast members.
2. Click the Compression Enabled check box to enable compression. 3. Click the kBits/second list box and choose the bit rate that you want to use for compression. See Table 5-2 to help determine the best bit rate for your application. 4. If you a want to convert the sound to mono from stereo, click the Convert Stereo to Mono check box to enable this conversion. 5. Click OK to complete the operation and return to Director’s main window. CrossReference
Other settings in the Compression tab deal with compressing the images in your movie. Chapter 8 discusses these options.
When you distribute a movie that uses Shockwave Audio Compression, you need to include the SWA Xtra with the file. You can choose to have it downloaded to the user’s computer via Shockwave’s automatic download capability, but it will need to be present for the compression to work. Note
If your movie uses MP3 or SWA audio, the compression setting will not affect the audio.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 189
Chapter 5 ✦ Using Sound
Compression schemes are a bit like snowflakes in a blizzard. No two of them are identical, and there are many from which to choose. The sound industry is struggling to establish standards to provide commonality across platforms. Director supports a variety of compression types, either directly or though the use of Xtras. The best idea is to choose the type that meets your platform needs, while providing the best quality for your movie.
Compressing and Streaming External Sound Cast Members On the CD-ROM
To practice converting WAV files to SWA and linking them as external sound files, use any of the WAV files on the companion CD-ROM in the EXERCISE:CH05:AUDIO (EXERCISE\CH05\AUDIO) folder. There is also a ready-made SWA file in the same folder, called idunno.swa.
1. Create an external Shockwave Audio file (SWA). Macintosh users can create this file using Bias Peaks LE. Windows users can use Director’s conversion command by choosing Xtras ➪ Convert WAV to SWA. The dialog box that appears enables you to specify the external sound files you want to convert (see Figure 5-17). Note
Macintosh users can skip Steps 2 through 7. Figure 5-17: Windows users can convert WAV files to SWA files.
2. Check the bottom of the dialog box. If the Folder for Converted Files indicated is not the folder in which you want to store your files, click Select New Folder. Navigate to a folder where you want to store your files, and then click Select Folder to return to the Convert WAV Files to SWA Files dialog box. (It’s a good idea to keep all associated Director files in the same directory, especially if you intend to distribute your movies on the Internet.)
189
3486-6 ch05.f.qc
190
7/24/00
5:41 PM
Page 190
Part I ✦ Working with Director
3. Click the Add Files button, and then navigate to and select the files that you want to convert. To select multiple files, press the Command (Ctrl) key and click each filename to highlight it. When all desired files are selected, click the Open button. If the files you need to convert are not in the same folder, you might have to repeat this step more than once. Selected files are displayed in the Files To Convert list. To delete a file from the list, select it and then click the Remove button. 4. Choose the Compression Settings you want to use. (For guidance, refer to the earlier instructions for compressing internal files.) 5. When you have added all the files to be converted and you have specified the compression settings, click the Convert button to begin the conversion. A progress bar appears, and you can watch as the compression occurs. 6. When the compression is complete, click the Close button to return to Director’s main window. 7. The compressed files are still external to your movie, so now you must add the sounds to your internal cast. Choose Insert ➪ Media Element ➪ Shockwave Audio. 8. When the SWA Cast Member Properties dialog box shown in Figure 5-18 appears, click the Browse button, navigate to the location where you saved the converted Shockwave Audio files, and double-click the one (or ones) you want to import. The conversion process automatically compresses the movie and changes its extension to .SWA, so look for files ending with this extension. You can use a URL (an Internet address) as the Link Address for the SWA file. Note
For this step, you can also use the idunno.swa file that’s on the CD-ROM in the EXERCISE:CH05:AUDIO (EXERCISE\CH05\AUDIO) folder.
Caution
The location or link you specify for the SWA cast member must remain the same or else a broken link occurs and the movie will fail. To reduce the possibility of broken links, store all linked files in the same folder.
Figure 5-18: The SWA Cast Member Properties dialog box enables you to specify the options for SWA cast member Xtras.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 191
Chapter 5 ✦ Using Sound
9. Specify a sound channel. The default is Any, which enables Director to assign a sound channel based upon availability. 10. Choose a Preload Time from the list box. This figure represents the maximum number of seconds that can lapse prior to streaming your sound. Because slow Internet connections can affect the transfer times, it’s a good idea to choose a higher value than the 5 seconds Director uses as a default. 11. Specify the volume you want to use for your sound file. It’s best to choose a medium volume as a compromise for all platforms. 12. Click the Play button to preview the sound. Click OK to return to Director’s main window. 13. Repeat Steps 8 through 12 for each SWA file that you want to use. 14. Place each of the SWA cast members in a sprite channel (not a sound channel), and extend the sprite to ensure that the sound plays completely. Using linked Shockwave Audio cast members for Web-based Director movies is a way to reduce the download time. Because the audio is actually a separate file located on a server, it doesn’t need to be downloaded with the movie. This feature also makes it possible to update the file independently of the rest of the movie.
The Beatnik Xtra Lite The Beatnik Xtra — built by a company called Headspace Incorporated — is similar to their Beatnik player for Web browsers, and enables you to use RMF (Rich Music Format) audio files in your movie. The RMF file format was developed to take full advantage of the Headspace Audio Engine, a multiplatform, General MIDI-compatible, 64-voice synthesizer that features custom downloadable sample files and enables you to create very sophisticated digital audio processing effects. The Beatnik Xtra also supports most other standard audio formats, such as WAV, AIFF, and MIDI. Rich Music Format audio files take up very little disk space, yet they provide an outstanding level of audio quality and are an ideal sound format to use for Shockwave applications. Unfortunately, RMF files cannot be imported into Director and placed in the score as a music sprite. You must use the new Lingo commands provided with Beatnik Xtra to incorporate RMF files into your movie. The up side to this is that you have a wide range of control over the sounds, and you can create very complex audio effects. Figure 5-19 illustrates an application of the Beatnik Xtra. CrossReference
Chapter 18 teaches you to use the Lingo commands and behaviors for the Beatnik Xtra.
191
3486-6 ch05.f.qc
192
7/24/00
5:41 PM
Page 192
Part I ✦ Working with Director
Figure 5-19: Using the Beatnik Xtra, you can create very complex audio effects.
Using Sound Behaviors Director enables you to alter the behavior of your movies by using Lingo scripting. The trade-off is that Lingo is a complex scripting language. If you aren’t familiar with programming or scripting languages, adding Lingo scripts to your movies can be daunting. In response to this challenge, Director uses behaviors. Behaviors are cast members added to sprites and frames of your movie to easily provide interactive functionality without complex scripting. You can find the built-in behaviors that come with Director in the Library Palette. New Feature
Director 8 includes four new sound behaviors — Pause Sound, Stop Sound, Channel Volume Slider, and Channel Pan Slider — that take advantage of the new sound capabilities added in this version of the program.
Director includes six built-in behaviors in the sound category. Each requires that you provide parameters, such as the name of a sound, the channel assignment, and the event that you want to use to start the behavior. Table 5-3 lists the behaviors and describes the usage and parameters that you can apply.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 193
Chapter 5 ✦ Using Sound
Table 5-3 Director’s Built-in Sound Behaviors Behavior
Description
Parameters
Play Sound
Used on the Stage, Score, or a sprite to play an assigned audio file.
Sound to play Defines the cast member used by the behavior Sound channel Choose which channel to use for playback When to play sound The event that triggers the sound Preload sound When to load the sound into memory before playing Seconds to preload Determines how many seconds of the sound are preloaded Number of loops Sets how many times the sound plays (0 = forever)
Pause Sound
Used on the Stage, Score, or a sprite to pause the sound in a defined channel.
Sound channel Assign which sound channel to pause When to pause sound Set the event that triggers the pause
Stop Sound
Used on the Stage, Score, or a sprite to stop the sound in a defined channel.
Sound channel Assign which sound channel to pause When to stop sound Set the event that triggers the pause
Sound Beep
Causes the system beep to play when a sprite that has the behavior applied to it is clicked.
None
Channel Volume Slider
Apply this behavior to a graphic sprite to turn it into a slider that controls the volume of the sound being played.
Sound channel Define which sound channel this slider controls Constraining sprite Assigns a sprite that determines direction and distance of slider movement (a setting of 0 uses the Stage for the constraint) Initial sound volume Sets the volume level for the chosen sound channel when the slider first appears Continued
193
3486-6 ch05.f.qc
194
7/24/00
5:41 PM
Page 194
Part I ✦ Working with Director
Table 5-3 (continued) Behavior
Description
Parameters
Channel Pan Slider
Apply this behavior to a graphic sprite to turn it into a slider that controls the pan from left to right of the sound being played.
Sound channel Define which sound channel this slider controls Constraining sprite Assigns a sprite that determines direction and distance of slider movement (a setting of 0 uses the Stage for the constraint) Initial sound pan Sets the initial pan setting for the chosen sound channel when the slider first appears
When you add a behavior from the Library Palette to a sprite or frame, the behavior is copied to the internal cast, to prevent the master behavior from being accidentally overwritten. Included in the Library Palette are a series of behaviors related to sound. For example, consider a movie that displays a series of musical instruments. By adding a behavior to each of the instrument sprites, you can play a sound file that makes the sound of that instrument when an event occurs. In the case of the instruments, you might want the sound to play when the user clicks the instrument. To display the Library Palette, choose Window ➪ Library Palette, and then display the sound behaviors (shown in Figure 5-20) by clicking the Library List button in the upper-left corner of the palette. Then choose Media ➪ Sound. CrossReference
Director’s behaviors and how to work with them are discussed in detail in Chapter 7.
Figure 5-20: Director’s built-in sound behaviors are located in the Library Palette.
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 195
Chapter 5 ✦ Using Sound
Summary Sound enhances your movies, and it adds the professional finishing touch to make your movie a success. By understanding sound basics, you can easily add sounds to your movies. In this chapter, you learned how to: ✦ Choose sound file formats that meet your platform’s authoring needs. ✦ Add sound to your movie and control it with tempo settings. ✦ Link larger sound files as external files. Place smaller sound files in the internal cast. ✦ Get the most out of sounds through repetition by using looping and by duplicating small sound files. ✦ Store Director files and linked files in the same location to prevent broken links and to improve loading time. ✦ Use behaviors to give sounds interactive functionality. ✦ Employ the Shockwave Audio Xtra to get the maximum compression for your sound files, and to use streaming audio. ✦ Use sound cue points to control the pace of your movie. Chapter 6 teaches you to incorporate digital video into your movies.
✦
✦
✦
195
3486-6 ch05.f.qc
7/24/00
5:41 PM
Page 196
3486-6 ch06.f.qc
7/24/00
5:41 PM
Page 197
6
C H A P T E R
Using Digital Video
✦
✦
✦
✦
In This Chapter
D
igital video is simply the result of capturing, storing, transmitting, and displaying a rapid succession of digitized images on a computer. The why of digital video is perhaps as important as the what. As mentioned earlier in this book, it is by appealing to multiple senses that multimedia enhances communications and increases the effective retention rate of the user. Digital video provides a superior means of transmitting images and sounds of real-world events and animations in your Director movies. The result, of course, is that the impact of your movies on your audience increases. Director movies containing digital video are appearing with increasing regularity in our world. Using digital video enables you to create: ✦ Interactive kiosks ✦ Training CD-ROMs that display complex procedures ✦ High-impact sales presentations ✦ Edutainment titles (movies that entertain as well as educate) ✦ Virtual 3D worlds, using Apple’s QuickTime VR technology. The variety of movies that you can create with Director is limited only by your imagination. Whether your movie will grace a boardroom or a home computer, that movie can be enhanced with digital video. Director uses two video formats, AVI (Video for Windows) and QuickTime. AVI movies can be imported into Director only from the Windows platform — they will play back on both platforms, though. An AVI movie is converted to a QuickTime movie when it’s played on the Macintosh platform. The AVI
Understanding digital video Adding digital videos to your movie Managing video cast members Exporting as digital video Using QuickTime VR
✦
✦
✦
✦
3486-6 ch06.f.qc
198
7/24/00
5:42 PM
Page 198
Part I ✦ Working with Director
format has other severe limitations as well. AVI digital video movies, for example, can be played only in Direct to Stage mode (discussed later in this chapter). There are also very few Lingo commands that you can use to control AVI videos. Director offers much more support for the QuickTime video format on both the Windows and Macintosh platforms. Using the QuickTime video format enables you to take advantage of the wide range of QuickTime movies that you can create, including audio-only movies and 360-degree QuickTime VR panoramas. Director also gives you much more Lingo control over digital videos that use the QuickTime format. QuickTime is the industry standard for digital video, and it is very prevalent on the Web. If possible, you should use QuickTime digital videos for your movies to take full advantage of all the features that Director provides for incorporating digital movies into your multimedia applications. On the CD-ROM
CrossReference
To get the most out of the exercises in this chapter, you should have QuickTime 3.0 or 4.0 installed on your computer. If you need QuickTime 4.0, you can find the installer for both Windows and the Macintosh on the companion CD-ROM in the UTILITIES&SHAREWARE:APPLE:QUICKTIME (UTILITIES&SHAREWARE\APPLE\ QUICKTIME) folder. There are also several QuickTime movies that you can use for the exercises in this chapter. They are in the EXERCISE:CH06:VIDEO (EXERCISE\ CH06\VIDEO) folder. The topics in this chapter introduce working with digital video. Director is a robust program that offers features for all levels of users, and in Chapter 19 you work with digital video at a more advanced level by learning to manage this medium with Lingo.
Working with Digital Video A series of factors is involved in the creation of any digital video. In terms of Director movies, the most important of these factors are frame rate, image dimensions, color depth, file size and compression, and image quality.
Determining an effective frame rate Frame rate is the number of frames per second (fps) that are displayed on a screen. A rate of 30 fps represents high quality, but it’s unrealistic. Most computers don’t have the resources to display video at that rate, and the amount of hard disk space required to store such data is prohibitive. For any system to display digital video without disruption to quality, it must be capable of transferring data at a consistent rate of 150,000 bits (150K) per second. The amount of data contained in a digital video with a frame rate of 30 fps is enormous. Consequently, lower-end computer systems are incapable of transferring and rendering this amount of data at the required rate to maintain quality.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 199
Chapter 6 ✦ Using Digital Video
A frame rate of 15 fps is much more realistic. Most computers can display this information without too much difficulty, enabling you to widen the range of your potential audience by choosing this lower rate.
Working with image dimensions When you are planning a Director movie, a key consideration is the final resolution at which the movie will be displayed. Director offers a variety of preset stage sizes, or you can specify a custom size that meets your needs. Before choosing a screen size, you should consider the typical computer configuration of your audience. For example, if you are developing a multimedia application that will be used in a corporate environment, you can safely assume that users will have 17-inch monitors set at 800 × 600 resolution. If you are developing for schools, which tend to have older computers, you may want to use a resolution of 640 × 480 to match the resolution of older 15-inch monitors. Director displays digital video in a window placed on the Stage. The default size of the window is equal to the exterior dimensions of the digital video frame. Although you can display a digital video at 640 × 480 pixels or larger, the file size would be prohibitive and might cause resource problems on low-end computers. Most computers are capable of playing back digital video at a resolution of 320 × 240 (the default size for a QuickTime movie) without any difficulty. You can also create your digital video at a smaller or custom frame size. Note
Director enables you to crop digital videos. For more information on cropping, see the later section “Scaling and Cropping a Digital Video.”
Considering color depth By default, Director for Windows plays all video in Direct to Stage mode (discussed later in this chapter) at a 24-bit color depth. On a Macintosh, the video is displayed at either 8-bit or 24-bit color depth. If your video hardware on a computer running the Windows operating system is set for 8-bit or 16-bit color depth, Director has to recomposite the image display to 24-bit. The result is a performance reduction in your movies. The digital video may appear jerky or slow. For best results in Windows, then, use digital videos that are set at 24-bit. If you get jerkiness or slowness in your 8- or 16-bit digital video, you can improve performance by sequencing images by using image and movie editors, or by respecifying cast member settings. The next exercise explains how to resequence images to improve performance. The section “Adding Digital Videos to Your Movies” later in this chapter discusses setting member properties.
Sequencing images to improve video performance Editing 8-bit and 16-bit images to improve video performance in Director is a somewhat tedious task, but if performance is a critical issue, it’s worth the effort. If the frames of the video are already stored as individual images, you are one step into the process. If they are not, you need to break your video into individual frames.
199
3486-6 ch06.f.qc
200
7/24/00
5:42 PM
Page 200
Part I ✦ Working with Director
Note
The following instructions for sequencing are very general. For more targeted instructions, consult the user manuals for your video and image editors.
Sequencing Images for Your Video 1. Import your video into a video editor, such as Adobe Premier (see Figure 6-1). If you already have the images set up as individual frames, skip to Step 5.
Figure 6-1: You can use a video editor such as Adobe Premier to convert an image into a sequence.
2. Export the video as a sequence of individual bitmap images or frames. Windows users will find it easier to save the images as BMP files, and Macintosh users should save the images as PICT files. 3. Open the sequence of images in a bitmap image editor or image converter, such as Equilibrium’s Debabelizer or Adobe Photoshop version 5.0 or later. (If your bitmap image editor or image converter allows for batch functions, this process will go more rapidly.) 4. Convert the images to RGB 24-bit images and save them. 5. Reimport the sequential images into your video editor. 6. Create a video file from the images. The video file is ready to import into Director.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 201
Chapter 6 ✦ Using Digital Video
Getting the best performance from animated sprites We all like to see the exotic. Sometimes, however, exotic animated sprites cause a movie to slow too much and to play at less than the desired frame rate. Suppose that your movie has a 24-bit sprite of a colorful parrot wildly flapping its wings. The bit depth of the color and the animation might reduce the performance of your movie, especially if other sprites are active at the same time. To adjust for this problem, you could reduce the color depth of the parrot or create a film loop. Neither of those options, however, is as effective as exporting the animation sequence as a digital video. After the digital video is created, you can import it and place it in your movie. The parrot maintains its color, the animation is smoother, and the performance of your movie improves.
Be aware that this method can be a formidable task if your image editor or converter doesn’t support batch functions. For instance, sequencing 20 seconds of digital video that has a frame rate of 15 fps requires converting 300 frames! CrossReference
For more information on exporting frames as digital videos, see the section “Exporting Digital Video,” near the end of this chapter.
Controlling file size and choosing compression Like other graphics and sound files, digital video files tend to be on the large side. The average video that plays in your VCR requires 10 inches of videotape for each minute of play at 30 fps. An equivalent digital video file could take as much as 1.6GB of hard disk space. The amount of space required varies, depending on other factors in the creation of computer imagery, such as color depth and resolution. Even with the frame rate reduced to 15 fps, an uncompressed digital video file can consume several hundred megabytes of disk space. The issue of file size has prompted substantial research to find a standardized means of compressing the data to an acceptable size. A variety of codec (compression/decompression) methods are available. At the time of this writing, however, there is no standardized file compression method that works with all platforms. Director does support some file-compression techniques employed in conjunction with Apple’s QuickTime and Microsoft’s Video for Windows AVI (Audio Video Interleave) format. It’s important, nevertheless, that you design your movie carefully to use a codec that is cross-platform if you intend to incorporate digital video files. To achieve compression, most codecs reduce the amount of information stored with the file. Like the proverbial cutting room floor, bits and pieces of the original data are cut out to create a smaller file. A hierarchy determines which data is cut. The human eye is extremely discerning of color but doesn’t as readily perceive
201
3486-6 ch06.f.qc
202
7/24/00
5:42 PM
Page 202
Part I ✦ Working with Director
slight differences in brightness or motion. Compression schemes, therefore, typically cut information that refers to minor changes in both brightness and motion. Many digital video files contain sound, and — again, because people tend to notice a disruption in sound before they notice a disruption in image quality — frames of the video may be sacrificed in order to maintain the sound quality. Note
QuickTime is designed to give audio priority, whereas AVI is not. If the audio quality is important, you might want to use the QuickTime Video format for your digital video.
MPEG format Director doesn’t directly support the MPEG (Motion Picture Experts Group) format for digital video files. Xtras are available, however, that enable MPEG video to be imported into Director. MPEG uses interframe compression to achieve compression rates of up to 200:1. Interframe compression analyzes each frame of a video for redundancy, to create what are called reference frames. By comparing previous and subsequent frames in a video, only the difference between the frames is stored. Redundant information is removed, and the result is a smaller file. Like most compression schemes, files compressed using MPEG can be lossy (as the compression ratio goes up, the quality of the video is reduced). MPEG is less lossy, however, than compression schemes employed by the QuickTime or AVI formats. You can play MPEG in your Director movies with the assistance of any of the following: an Xtra, Lingo MCI messages, a Windows driver, or a Macintosh system extension designed for this purpose. The drawback with MPEG is that each type of software implements the compression differently, and this can make it difficult to control the quality of playback on all types and platforms of computers.
Selecting an image quality Probably the most important factor in making decisions regarding digital video in Director is image quality. We’ve saved discussion of this final factor for the last because it determines your final decision. You must decide what look is acceptable for your movie, given the constraints of file size and performance. The decision on how you use digital video is subjective, but should be influenced by your client’s needs, the characteristics of the target audience, and the content of your end product. Ask yourself these questions: ✦ Is there a truly valid need for the digital video to be full-screen and, if so, will the end-user’s computer system support the required data transfer rates without choking? ✦ Using a smaller digital video window would lose what content? Would there be a significant loss of clarity, or detail, or both?
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 203
Chapter 6 ✦ Using Digital Video
✦ Is there supplemental content that should be concurrently displayed on screen with the digital video — which might necessitate less than a full-screen digital video window? ✦ How will the end product be delivered (over the Internet, on CD-ROM, in a stand-alone kiosk format, and so on)? Will that medium handle the quantity of digital video? With the range of possibilities available (various codecs, frame rates, image size, and so on), only you can determine how much of your movie’s resources should be dedicated to the delivery of digital video. Be sure to consider what’s happening in the rest of the screen(s) across which the digital video plays. In most cases, your Director movie and the video in it will have more consistent performance and greater impact if you design the layout for the video to play in a smaller window.
Note
Adding Digital Videos to Your Movies Digital video files are imported and placed in the Cast window in the same manner as other files, but Director manages digital videos differently. By default, all digital videos are imported in Direct to Stage mode as linked files rather than contained in the movie. When Director links a file to your movie, it places a thumbnail of the cast member into the internal cast, as it would for any other cast member. In reality, the thumbnail doesn’t represent the actual file, however. It is a pointer to the location where the file is stored. When you save the movie, the location is stored with the movie. If you move the file to another location, Director won’t be able to find the file, and your movie won’t run correctly. To avoid this problem, store linked files, such as digital videos, in the same folder as your movie. Alternately, for better organization, you can store all the video files in a folder that is “down directory” from the movie. In other words, they will be in the same folder, just one layer deeper. Caution
Unlike sound files, you cannot include digital video sprites in a film loop. Although the video will appear at the appointed time in the film loop, it won’t play.
On the CD-ROM
There are two QuickTime digital video movies on the accompanying CD-ROM, landing.mov and radar.mov, that you can use for this exercise. They are in the EXERCISE:CH06:VIDEO (EXERCISE\CH06\VIDEO) folder. For better performance, you may want to copy the files to your hard drive.
Importing a Digital Video Cast Member 1. Open a new movie in Director and choose File ➪ Import to display the Import Files dialog box (see Figure 6-2).
203
3486-6 ch06.f.qc
204
7/24/00
5:42 PM
Page 204
Part I ✦ Working with Director
Figure 6-2: You select the digital video files that you want to place in your movie in the Import Files dialog box.
2. In the Show: File Type menu, choose QuickTime (Mac) or Video Clip (Windows). This restricts the file list to only those digital video files that are supported by Director. 3. In the Media list menu at the bottom of the window, choose Include Original Data for Editing if you want Director to include a pointer back to the video editor you specified in the Editor Preferences dialog box. This enables you to quickly access your video editor by double-clicking the associated cast member in the Cast window. 4. To import a single file, select it in the file list and then click the Import button. Or, if you want to choose more than one file or choose files from several folders, click the Add button instead, and the files will be listed in the file list window. When you’ve finished selecting your files, click Import to complete the operation and return to Director’s main window. The digital video cast members appear in the active cast. Note
You can also insert QuickTime movies by choosing Insert ➪ Media Element ➪ QuickTime. When you choose this operation, an empty cast member appears. Click on the Properties button to display the Cast Member Properties dialog box, and then click on the Options button. When the QuickTime Xtra Properties dialog box appears, click on the Browse button, and locate the movie that you want to import into Director.
After your files are placed in the cast, you can put the videos on the Stage and test their performance. Similar to other sprites, Director extends the video sprite across the number of frames you specified in the Sprite Preferences dialog box (displayed by choose File ➪ Preferences ➪ Sprite).
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 205
Chapter 6 ✦ Using Digital Video
Placing a Digital Video on Stage 1. Import a video file into your movie, and then click the frame in the Score where you want the digital video to start. 2. Drag the digital video from the Cast window to the location you selected in the Score. Alternatively, you can drag the digital video cast member to the Stage. Director places the video sprite in the first open channel of the active frame (see Figure 6-3). When you place the video into the Score and play the movie, the cast member appears on top of any other elements on Stage, regardless of its channel position. This is because Director, by default, imports digital videos with the Direct to Stage property set to TRUE. The Macintosh version of Director enables you to turn off the Direct to Stage option, but Director for Windows does not.
Figure 6-3: Place your digital video cast member in the Score, and extend the sprite to make sure that the video plays completely.
3. Rewind your movie and play it. If the video doesn’t play completely, click the end frame of the video sprite and drag it to the right to extend it. The sprite must extend through sufficient frames for it to play completely. Note
You can also set the Tempo to a slower frame rate by double-clicking a frame in the Tempo channel in the Score window and selecting a slower frame rate. A slower tempo setting does not affect the playback speed on the video, only the speed of the playback head as it moves across the frames in the Director movie.
4. Rewind and play your movie again. Repeat Step 3 as needed to ensure that the video plays completely. Tip
If you’d like to preview your video, you can choose Window ➪ Video, or press Command+9 (Ctrl+9). Your video appears in the Video window. If the video is a QuickTime (.mov) file, a control bar appears at the bottom of the window, enabling you to play, stop, advance, or rewind the movie. When the movie is stopped, you can cut, copy, and paste frames from one video to another.
205
3486-6 ch06.f.qc
206
7/24/00
5:42 PM
Page 206
Part I ✦ Working with Director
Understanding Direct to Stage mode Director supports QuickTime movies for both Macintosh and Windows. You can also import Video for Windows (AVI) files for use in the Windows version of Director. Both QuickTime and AVI formats enable you to incorporate audio effects in the file. When you place videos on the Stage, Director displays them using the default Direct to Stage option. This option allows for the best speed and smoothest display of digital video in a Director movie. Because this is the recommended way to use video in a Director movie, it is important to design the layout of your presentation so that the space required to play the video doesn’t interfere with other elements on the Stage. Direct to Stage has both advantages and drawbacks, however. When this option is enabled, you can sync your video to the soundtrack, effectively modifying the speed with which frames are displayed. You can also specify that Director play every frame, and set the maximum speed for the playback of your video. As noted earlier in this chapter, if you specify a frame rate, the video will play at the fastest speed possible, given resources and the frame rate of the video. It won’t play faster than the embedded frame rate, however. One drawback to the Direct to Stage option is that it places the digital video in front of every sprite on the Stage, regardless of the channel in which the video sprite is placed in the Score. Another limitation is that ink effects and transitions don’t work. Without the use of ink effects, it’s nearly impossible to conceal the perimeter rectangle that surrounds the movie window. Tip
It’s possible to have a QuickTime movie play in Direct to Stage mode, and yet still have it display in a nonrectangular format, by assigning a 1-bit cast member to act as a mask for the video. The default setting enables the video to show through the black pixels of the image. This advanced technique can only be accomplished using Lingo.
You can enable or disable the Direct to Stage option in the Digital Video Cast Member Properties dialog box.
Enabling or Disabling Direct to Stage 1. With the video cast member selected, choose Modify ➪ Cast Member ➪ Properties or click the Cast Member Properties button in the Cast window to display the Digital Video Cast Member Properties tab in the Property Inspector (see Figure 6-4). 2. Click on the Direct to Stage check box to enable or disable the option. If a check mark appears in the box, the option is enabled.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 207
Chapter 6 ✦ Using Digital Video
Figure 6-4: The Direct to Stage check box is located in the QuickTime Tab of the Property Inspector.
Direct to Stage
Note
The name of this dialog box reflects the format in which the video was created. A QuickTime movie was used when creating Figure 6-4, so the tab box is called QuickTime.
Choosing whether to use Direct to Stage is a matter of assessing the needs of your movie. If the video has audio properties and you need to sync the video to the sound, leave Direct to Stage enabled. If it’s more important that your video blend in with the background, or if you have sprites that need to animate above the video, you’ll want to disable Direct to Stage. Remember that when this feature is disabled, you’ll be able to apply ink effects to your video and transitions to the frame.
Syncing video to sound If you are creating a video with sound for use in a Director movie, it’s a good idea to map or sync the audio file to the video before importing it into Director. Adobe Premiere and other video editors provide the tools to ensure that the sound plays at the same frame rate as the associated video portion of the file. Taking the time to sync your video and sound beforehand helps you manage the way Director processes such files. By default, Director syncs the frame rate of your video to match the embedded audio track. This syncing makes your movie appear more polished, but Director will skip playing frames in your video, if necessary, to achieve syncing; and skipping frames can produce undesirable results. You can avoid this by telling Director not to skip frames (if the video has no sound or you don’t need the sound to play). Do this by choosing Play Every Frame for the Video selection in the cast member’s Properties dialog box. Be aware, however, that choosing Play Every Frame disables sound.
207
3486-6 ch06.f.qc
208
7/24/00
5:42 PM
Page 208
Part I ✦ Working with Director
Digital video properties As you saw in the preceding exercise, you can set several other properties for your QuickTime digital videos. As with most other cast member properties, the List View mode of the Property Inspector, shown in Figure 6-5, labels the properties as they are referred to in Lingo scripts. It’s important to understand how each of these properties affects the way that digital video files will play back in your movies. Table 6-1 describes all of the properties you can set for QuickTime digital video. Figure 6-5: The List View mode of the digital video member properties labels them as they are referred to in Lingo scripts.
Note
The properties in Table 6-1 are listed as they appear in the List View mode of the Property Inspector.
Table 6-1 QuickTime Digital Video Properties Property
Description
sound
Plays the embedded sound in a video if enabled.
pausedAtStart
When enabled, causes the video to remain on its first frame when it appears on the Stage. You need to use Lingo to set some kind of event to trigger it.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 209
Chapter 6 ✦ Using Digital Video
Property
Description
loop
When checked, the video loops back to the first frame and plays again continuously.
preload
Enables a video to preload into system memory before it’s played. This allows for better playback performance but increases the memory demands of your movie. Use with the Lingo command preloadRam to control how much of the video file is loaded into memory.
frameRate
Determines the frame rate at which the movie will attempt to play back. The user’s system resources will have as much, if not more, effect on the frame rate. Set this property by clicking on the arrow and adjusting the slider to the desired frame rate. To have the video synchronize to an embedded soundtrack, set the value to 0. To set the frame rate to the Normal setting, type –1 into the value; for the Maximum playback setting, type –2 into the field.
streaming
Determines whether a video will stream when played back over the Web. This feature is only supported on systems that have QuickTime 4 installed. It will have no effect on systems that have older versions of QuickTime. Can be set in both the Playback Properties and the Display Properties sections.
percentStreamed
Available only in List View. If streaming is enabled, it returns the percentage of the file that has been downloaded to the user’s computer. This property cannot be set. It only returns a value.
directToStage
Renders the video directly to the user’s screen. Plays the video at optimum performance but cannot be used if other sprites need to appear on top of the video or if ink effects need to be applied
crop
Enables the video to be cropped on the Stage. Set it to false if you want to scale a digital video.
center
When set to true, the video appears in the center of the rectangle created when cropped. Has no effect unless crop is enabled.
video
Enables the video of a digital video member to play. Set to false if you only want the audio to play.
controller
Enables the standard QuickTime controller to be displayed. Defaults the pausedAtStart property to true when enabled.
Mask
Available only in List View. Assigns a 1-bit cast member — used as a mask — in which the video will appear. The default setting is for the video to appear in the black pixels of the member.
invertMask
When a 1-bit cast member is assigned as a mask for a video, the video appears in the white pixels of the cast member instead of in the black pixels of the member.
209
3486-6 ch06.f.qc
210
7/24/00
5:42 PM
Page 210
Part I ✦ Working with Director
New Feature
Director now supports QuickTime 4.0’s streaming capabilities.
CrossReference
Other options for controlling digital video in your Director movies are available through Lingo commands. See Chapter 19 for further details.
Scaling and cropping a digital video Director enables you to scale and crop digital video cast members. Because the scale and crop options are cast member options, they affect the entire sprite rather than a single frame. Normally it’s not a good idea to scale any type of bitmap image, even a digital video, by a large amount. Scaling degrades the quality of the image, especially if you increase the size. Video editors don’t always enable users to create custom frame sizes, though, and your movie might call for a size that fits a specific area of your movie’s layout. If you can live with some degradation of quality to get a custom fit, then try scaling and see what you get. First, use your video editor to create the closest size for your needs. Then you can scale the video in small amounts to create the custom size, while minimizing the loss of quality. On the CD-ROM
For the next three exercises, start with the sim.dir movie located on the CD-ROM in the EXERCISE:CH06 (EXERCISE\CH06) folder. This Director movie contains two QuickTime digital movies. If you move the movies to your hard drive, make sure that you include the folder called video at the same level as the sim.dir Director movie.
Scaling a Digital Video 1. In the Cast window, select the video cast member called landing and drag it onto the Stage so that the video sprite is positioned as shown in Figure 6-6. 2. Choose Modify ➪ Cast Member ➪ Properties (or press Command+I or Ctrl+I) to display the Property Inspector. You may have to click on the QuickTime member tab to make it the active window. 3. In the Framing section, click the Scale radio button to enable the option. Click OK to return to Director’s main window. 4. On the Stage, drag the handle in the lower right corner to resize the video sprite so that it fits inside the black box. The video appears scaled on the Stage (see Figure 6-7). 5. Save the movie as sim1.dir. You can also crop a video. This capability is useful if you want to display a portion of the video within its bounding box. Although cropping has a similar appearance to scaling, it doesn’t actually resize the image. It merely hides a portion of the image. If you stretch the bounding box of the video later, it will reveal portions of the image that were previously hidden.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 211
Chapter 6 ✦ Using Digital Video
Before scaling
Figure 6-6: Position the video sprite on the Stage.
After scaling
Figure 6-7: Scale the video sprite so that it fits in the window. Tip
By cropping your videos, you can reduce a distracting background. Cropping is also useful for creating special effects within your movies by enabling you to focus on a particular section of an image.
Cropping a Video 1. Open the sim1.dir movie from the last exercise, if it’s not already open. Select the video cast member named radar in the Cast window.
211
3486-6 ch06.f.qc
212
7/24/00
5:42 PM
Page 212
Part I ✦ Working with Director
2. Click the Properties button in the Cast window to display the Digital Video Cast Member Properties tab in the Property Inspector. 3. Under Framing, click the Crop radio button to enable the option, and then click the Center check box so that the video remains centered inside the bounding box after it is cropped. Then click OK to return to Director’s main window. 4. Drag the radar video cast member onto the stage. Note that there is a distracting yellow background surrounding the video (see Figure 6-8).
Before cropping
Figure 6-8: Remove the yellow background by cropping the video sprite.
5. On the Stage, drag the handles of the video sprite’s bounding box so that the yellow background is eliminated. Position the sprite in the window on the right, as shown in Figure 6-9. 6. Save the movie as sim2.dir. Rewind the movie and play it back. Caution
When you scale the Stage, the video sprite appears at its original size. If you try to crop a video with the Stage set at a zoom level other than 100%, you will get unexpected results.
Setting looping and controller preferences When you played back the movie in the preceding exercise, you were probably thinking that it would be nice to have the radar video constantly looping to create a more realistic effect. The Digital Video Cast Member Properties dialog box also enables you to specify looping and whether you want a visible controller for the video. Both of these settings affect the behavior of your movie.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 213
Chapter 6 ✦ Using Digital Video
After cropping
Figure 6-9: The video sprite is cropped and moved into position.
If you set a video to loop, the action repeats until the playback head goes beyond the number of frames you’ve allotted for your video. If looping is not enabled, the video plays to the end and then displays the last frame of the video until the playback head moves beyond the last frame you allotted for your video. To enable/disable looping, check the Loop check box in the Playback options. If you enable Show Controller, a control bar appears below your movie that enables the user to start, stop, and step through the movie. The Show Controller check box option is available only if Direct to Stage is enabled. Caution
It’s not a good idea to enable the controller for a video cast member if it will be scaled, cropped, or used while another video is playing. This puts a huge demand on the system resources and can cause all kinds of strange things to happen.
Looping a Digital Video 1. Open the sim2.dir movie in Director if it’s not already open, and then select the radar video cast member. 2. Click the Properties button in the Sprite Overlay to display the Digital Video Cast Member tab in the Property Inspector. 3. Click the Loop check box to enable the option. Then click OK to return to Director’s main window. 4. Rewind the movie and play it. The radar screen now continuously rotates while the other video is playing. 5. Save the movie as sim3.dir.
213
3486-6 ch06.f.qc
214
7/24/00
5:42 PM
Page 214
Part I ✦ Working with Director
Specifying an external editor for Video cast members You can specify an external editor for a video cast member, so that you can quickly jump to an editing application outside of Director to modify your digital video. Double-click a cast member for which you’ve specified an external editor, and Director starts the editor and opens the video in it. After you’ve modified your video, save the changes and click Exit; the video cast member is updated automatically with the modifications that you made in the editor. Tip
You can edit a QuickTime movie in Director. This technique is discussed later in this section.
Specifying an External Video Editor for Video Files 1. Choose File ➪ Preferences ➪ Editors to display the Editors Preferences dialog box. 2. Scroll through the file type list, and select Video Clip (see Figure 6-10). Figure 6-10: Choose the file type for which you want to use an external video editor.
3. Click the Edit button to display the Select Editor for Video Clip dialog box. 4. Select the Use External Editor option, and then click either the Browse button or the Scan button (shown in Figure 6-11). If you click Browse, the Open dialog box appears; this is where you can navigate to the executable file that starts your video editor. If you click Scan, Director scans your computer for possible editors by searching for program files, and presents you with a list from which to choose. 5. Select the editor that you want to use, and click Open to return to the Editors Preferences dialog box. Click OK again to complete the operation and return to Director’s main window.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 215
Chapter 6 ✦ Using Digital Video
Figure 6-11: Choosing an external video editor
Normally, double-clicking opens a QuickTime digital video in Director’s Video window. If you assign an editor, however, this action opens your video in the external editor you specified.
Note
Editing a digital video within Director There are times when you need to resequence images, or use only a portion of a digital video that you have imported into your movie. You can use an application that is capable of editing the video file, or you can perform some editing operations within Director itself. Although the process is a bit cumbersome — and you don’t have the accuracy and special effects capability that video-editing programs such as Adobe Premiere have — it’s very useful to be able to perform these operations in Director, especially if you don’t have a video-editing application on your computer. When you double-click on a QuickTime video cast member — provided you have not assigned an external editor for QuickTime — the QuickTime window opens up, as shown in Figure 6-12. The video appears in the window, along with a controller that enables you to play the entire movie, step through the movie one frame at a time, or jump to a particular section of the movie. You can also use the controller to select a specific range of frames and then copy the frames into a new video cast member. Caution
When you modify a video cast member, you are actually changing the original file to which the cast member is linked. It’s a good idea to make a copy of the movie that you are about to modify so that you have the original version of the movie in case you need to use it again.
On the CD-ROM
For this exercise, you can import the QuickTime movie called landing.mov, located on the CD-ROM in the EXERCISE:CH06:VIDEO (EXERCISE\CH06\VIDEO) folder.
215
3486-6 ch06.f.qc
216
7/24/00
5:42 PM
Page 216
Part I ✦ Working with Director
Play button
Video controller
Playback head
Single frame advance button Single frame reverse button
Figure 6-12: Double-clicking on a video cast member opens the QuickTime window.
Resequencing a QuickTime Movie 1. Double-click on a QuickTime video cast member to open it in the Video Cast Member window. 2. Select the beginning section of the video by moving the playback slider in the controller to the point where you want the selection to begin. 3. Hold the Shift key down and move the playback slider to the point in the movie where you want the selection to end. The section of the video that is selected shows up as a black area in the controller bar (see Figure 6-13). Figure 6-13: You can select a section of the video.
Selected section of video
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 217
Chapter 6 ✦ Using Digital Video
Tip
Use the single-frame buttons or the arrow keys on the keyboard to fine-tune the selection.
4. Copy the selection to the Clipboard, and then click on the New Cast Member (+) button to create a new video cast member. 5. Paste the selection in the new window, and a dialog box appears, prompting you to create a new QuickTime movie file (see Figure 6-14). Select the location where you want to store the movie, and then type in a name for the file. Figure 6-14: Select a location to store the new movie and type in a name for the file.
Note
Even though the movie was created in Director, it is still stored as an external file that is linked to the Director movie. Make sure that you don’t move the file to a new location after it is created or it will not play in the Director movie.
6. Back up to the previous video cast member by clicking the Previous Cast Member (left arrow) button at the top of the window, and repeat Step 3 to select another section of the video. 7. Copy the section, and then advance to the new video cast member by pressing the Next Cast member (right arrow) button. 8. Move the playback head to the position in the movie that you want to be the endpoint of the selection that you are pasting in. An alert message appears, warning you that you are about to change a linked file (see Figure 6-15). Click OK. The selection is then inserted into the movie. Figure 6-15: This alert message warns you that you are about to modify a linked cast member.
217
3486-6 ch06.f.qc
218
7/24/00
5:42 PM
Page 218
Part I ✦ Working with Director
Caution
You cannot undo this operation because it is being performed on an external file. It’s a good idea to create a copy of the cast member so that you don’t accidentally ruin the original one.
9. Press the Play button in the controller to view the changes that you have made to the video cast member.
Controlling Video Cast Members Often you need to have the movie wait on a particular frame until a video has reached a specific point or has finished playing. Suppose that you have several sprites that represent status lights on the Stage that need to change color as the video progresses. It would be almost impossible to accurately synchronize the lights changing with the video, due to the variety of computer systems your Director movie might be played on. As you already know, digital video can be quite the resource hog and it’s difficult to accurately predict how it will play on any given system. The most straightforward way to accomplish this without using Lingo is by setting tempo settings that tell Director to wait on a frame until a specified point in the video has played.
Specifying tempo settings Director enables you to specify tempo settings to control the way your movie interacts with video cast members. This is useful for pausing the movie while waiting for a video to finish playing. You can also use tempo settings to control the video and interactive portions of the movie. By setting cue points in the digital video, you can have the Director movie pause until the video has reached the predetermined cue point. After the digital video has reached the cue point, the Director movie continues. Before Director can recognize a cue point set within a video, however, you must first define the cue point, using an application that is capable of inserting cue point into a digital video. Both BIAS Peak LE 2 on the Macintosh and SoundForge XP4 on Windows — the default soundediting applications supplied with the Director Studio — are capable of performing this operation. The QuickTime movie landing.mov that you have used in previous exercises has several cue points added to it. You use the landing.mov file in the next two exercises to insert tempo settings that control the playback of the Director movie On the CD-ROM
You can use the vidcue1.dir and vidcue2.dir movies on the CD-ROM located in the EXERCISE:CH06:VIDEO (EXERCISE\CH06\VIDEO) folder for these exercises. If you copy the movies from the CD-ROM to your hard disk, make sure that you also put a copy of the folder called video, which contains the imported landing.mov QuickTime movie, into the same folder on your hard disk into which you copied the Director movies.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 219
Chapter 6 ✦ Using Digital Video
Pausing a Movie to Wait for a Video to Finish Playing 1. Open the vidcue1.dir movie in Director, and display the Score window. If the effects channels are not visible, click on the Hide/Show Effects channel button to display the effects channels. 2. Double-click the Tempo channel in frame 60, located directly below the marker named “end” (shown in Figure 6-16) to display the Frame Properties: Tempo dialog box.
Tempo channel
Figure 6-16: Double-clicking in the Tempo channel of a frame that contains a video sprite causes the Frame Properties: Tempo dialog box to appear.
3. Click the Wait for Cue Point radio button to enable that option, and select the video from the Channel list. 4. In the Cue Point list, choose {End}, as shown in Figure 6-17. Click OK to return to Director’s main window.
Figure 6-17: Choosing {End} as the Cue Point forces Director to wait for your video to finish before continuing to the next frame of your movie.
219
3486-6 ch06.f.qc
220
7/24/00
5:42 PM
Page 220
Part I ✦ Working with Director
5. Drag the Score toward the bottom of the screen so that both the video sprite and the Score window are visible on the Stage; then rewind the movie and play it. In the Score window, the play head pauses at the {End} cue point you inserted in the Tempo channel until the QuickTime movie finishes playing, and then advances to the next frame. Even if you don’t have any cue points in your video, choosing {End} for the cue point setting causes Director to wait for the video to finish playing before continuing to the next frame of your movie. Tip
It’s not necessary to add markers to your movie in order to insert a cue point. Putting markers in your movie at the frames where you will insert cue points, however, makes it much easier to organize the movie if you’re adding more events that need to occur when the movie reaches a cue point.
Pausing a Movie to Wait for a Specific Cue Point in the Video 1. Open the vidcue2.dir movie in Director, and then make the Score window active. If the effects channels are not visible, click on the Hide/Show Effects channel button to display the effects channels. 2. Note the markers that have been placed in the Marker channel of the Score (see Figure 6-18). These markers are labeled with the same name as the actual cue points that you will insert into the Tempo channel.
Cue point markers Figure 6-18: Adding markers to the frames where you want to add cue points makes it easy to identify the frames where the cue points will be inserted.
3. Double-click the Tempo channel in frame 9, directly below the marker called Side view. The Frame Properties: Tempo dialog box appears. 4. Click the Wait for Cue Point radio button to enable the option, and then select the Side View cue from the Cue Point pop-up menu (see Figure 6-19).
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 221
Chapter 6 ✦ Using Digital Video
Figure 6-19: Select a cue point from the Cue Point pop-up menu.
5. Repeat Steps 3 and 4 to insert cue points underneath the Ortho view, Top view, Interior view, and Touch down markers. The markers are labeled with the same names as the cue points that you’re going to insert.
Note
6. Double-click on the Tempo channel in frame 60 (directly below the marker named end) and insert an {End} cue point. 7. Drag the Score window toward the bottom of the frame so that the video and text sprites are visible on the Stage. Rewind the movie and play it. Note that the text sprite is changing along with the scene changes in the QuickTime movie. Using cue points enables you to pace your movie and coordinate video events. To stop or pause a video, however, you need to add video controls by using Lingo or the Video Behaviors located in the Library Palette. CrossReference
More sophisticated integration of video, sound, and interactivity is accomplished by using Lingo statements within your movie. Chapter 19 discusses using Lingo to control digital video.
Working with video behaviors Behaviors are small Lingo scripts that control interactivity and the behavior of sprites. The video behaviors are located on the Library Palette. Open the Library Palette by choosing Window ➪ Library Palette. To access the video behaviors, click the Library List button in the upper-right corner of the palette and then choose Media ➪ QuickTime. When you apply a video behavior, a dialog box prompts you to enter parameters that control the behavior. Examples of parameters are the channel number of the video sprite or the number of frames the video occupies. Chapter 5 introduced you to behaviors for sound. Behaviors are prepackaged Lingo scripts with which you can quickly and easily control cast members. You just select
221
3486-6 ch06.f.qc
222
7/24/00
5:42 PM
Page 222
Part I ✦ Working with Director
the behavior that you want to use and drop it onto the sprite in the Score window or on the Stage. Director then prompts you for the parameters that define the action you want to apply. The advantage of using these two new features is the ease with which you can quickly create scripts. For example, you can create a custom control bar for your QuickTime cast member that enables the user to play, stop, or pause the video. The Library Palette contains two built-in Behaviors that you can use to control several different properties of QuickTime movies: ✦ The QuickTime Control Button behavior can be applied to a sprite that will act as a button to control the QuickTime video sprite. The parameters that you can set with this behavior are: Play, Rewind to the beginning of the video, Jump to the end of the video, Fast Forward at 2X the speed, or Fast Rewind at 2X the speed. You could easily make a VCR-like control panel to control QuickTime movies with this behavior. ✦ The QuickTime Control Slider behavior is used to create a custom slider that functions much the same way as the standard controller that can be displayed with QuickTime movies. Behaviors are a quick way to add simple Lingo scripts to your sprites and cast members. They guide you through the process of applying a script by requesting the information required. Attach as many behaviors to a sprite as you want to get the effect you want. CrossReference
Learn more about Director’s built-in behaviors in Chapter 7.
Exporting Digital Video Director enables you to export any range of frames as a digital video. After you’ve exported the frames as a digital video, you can import that video back into Director as a single cast member. The Radar QuickTime movie that you used earlier in this chapter was created using this technique. It started its life a series of sprites that were animated in Director and then exported as a QuickTime video. When you export a Director movie, it retains tempo settings, palette effects, and transitions; however, any interactivity that is in the selected range of frames is lost. In addition, if you choose to export the frames as a Video for Windows (AVI) file, Director doesn’t save any sounds with your video. Director only exports sounds using the QuickTime file format. Caution
Executing Director transitions in a QuickTime or AVI movie can bring a computer’s system resources to its knees. It’s much safer to remove the Director transitions when you export the Director movie as a video file, and then add transitions to the exported file with a video-editing program such as Adobe Premiere.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 223
Chapter 6 ✦ Using Digital Video
When you export a range of frames as a digital video, Director internally plays that portion of your movie, capturing the action as it would appear on Stage. Any scripts or other elements that have a visible effect during that playback time are captured, as well. It’s important to remember that Director captures the entire Stage at its current size. If the action you want to save as a video is smaller than the current Stage size, you need to resize the Stage accordingly. Any elements that are off the Stage but still visible in the Stage window will not be visible in the exported video. Before resizing the Stage, be sure to use the Save As command to save your movie using a new name. This way, you can avoid resizing the Stage back to its original settings before importing your digital video back into your movie. It also provides you with a backup file of the original movie if the results of your export are unsatisfactory. If the Stage is zoomed, it will have no effect on the final size of the video file.
Note
If you are exporting your Director movie as a QuickTime digital video, you need to consider the compression format that you are planning to use. The compression setting that you choose can greatly affect the way the digital video will play back. Table 6-2 lists the compression settings that are available with QuickTime and describes the best use for each one.
Table 6-2 QuickTime Compression Settings Compressor
Description
Animation
This compression scheme works best for computer-generated animations that contain flat colors. It doesn’t work well for a scene that has gradient colors or photographic-type scenes in it.
BMP
Used for exporting a sequence of BMP images. This scheme does very little compression and shouldn’t be used for video output.
Cinepak
This compression method is ideal for videos that will be played back from CD-ROM.
Component Video
This compression scheme should be used if the movie you are exporting will be incorporated in a video presentation using a highend video-editing system, such as an AVID.
DV - NTSC DV - PAL
Formats used for digital video cameras. They are not recommended for exporting video from Director.
Graphics
This scheme is good for exporting 8-bit graphics, although the decompression time is very slow. Continued
223
3486-6 ch06.f.qc
224
7/24/00
5:42 PM
Page 224
Part I ✦ Working with Director
Table 6-2 (continued)
On the CD-ROM
Compressor
Description
H.263
This scheme was designed for video conferencing. It uses very high compression ratios. Movies compressed with this method lose quite a bit of quality.
Intel Indeo Video Interactive
Although a very high quality compressor, this scheme requires a Pentium processor for compression and decompression and is available only on the Windows platform.
Motion JPEG A Motion JPEG B
These compression schemes require a special motion-JPEG card to be installed in order to play back videos that use these compression formats.
None
Good for capturing video or exporting movies that will be captured by a high-end video-editing system, such as the AVID.
Photo JPEG
This scheme is good for exporting still images and QuickTime VR files. The decompression is very slow, so it’s not good for motion video.
Planar RGB
This scheme supports graphics with alpha channels. It’s good to use if you are exporting a series of images that will be composited (combined) with other video segments.
Sorenson Video
This scheme offers very high compression ratios with good image quality. It’s ideal for digital video that will be played back over the Web.
Video
This is a very fast compression/decompression scheme that is good for video that will be played back from a hard disk.
You can use the radar.dir movie on the companion CD-ROM for this exercise. The radar.dir movie is in the EXERCISE:CH06 (EXERCISE\CH06) folder.
Exporting a Range of Frames as a Digital Video 1. Open the radar.dir movie in Director. 2. Choose the File ➪ Export or press Command+Shift+R (Ctrl+Shift+R). The Export dialog box appears (see Figure 6-20). Tip
Prepare your movie for export by checking and testing all media. Don’t waste time by allowing a spelling error or a misplaced sprite to be discovered on the Stage after you’ve already exported to video!
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 225
Chapter 6 ✦ Using Digital Video
Figure 6-20: The Export dialog box
3. Set the Format field at the bottom of the dialog box to the desired export format (Video for Windows, DIB File Sequence, PICT, Scrapbook, PICS, or QuickTime Movie). Different options are available, depending on the platform with which you are using Director. 4. Using the radio buttons at the top of the dialog box, indicate whether you want to export the Current Frame, Selected Frames (which you must have selected before you open the Export dialog box), All Frames, or a Frame Range. If you choose the Frame Range option, enter the starting and ending frame numbers in the Begin and End fields next to the Frame Range radio button. 5. Click the Options button. a. If you are using Director for Windows and exporting to Video for Windows, the Video for Windows Export Options dialog appears, prompting you to enter the frame rate for the video. b. If you are exporting a QuickTime 4 movie, the QuickTime Options dialog box appears, as shown in Figure 6-21. Figure 6-21: The QuickTime Options dialog box appears for exporting to QuickTime.
225
3486-6 ch06.f.qc
226
7/24/00
5:42 PM
Page 226
Part I ✦ Working with Director
Note
Before exporting frames as digital video, disable any screensavers that might be active. Exporting to digital video can take time, and if your screensaver comes on during the process, it will be included in your video.
6. If you are exporting as a Video for Windows movie: a. Enter the fps (frames per second) in the Frame Rate field and click OK to close the dialog box and return to the Export dialog box. b. Click the Export button, and enter a filename for your video. c. A Video Compression dialog box appears in which you choose the codec to use, the compression quality, and the placement of keyframes. d. Click OK, and the movie is exported to video. Be prepared for a wait; video compression takes time. If you are exporting as a QuickTime 4.0 movie: a. Choose the compressor or codec type in the QuickTime Options dialog box. See Table 6-2 for more details on each of these settings. In addition, choose the Quality, Color Depth, Scale (such as 25%, 50%, 75%, or 100% of the movie’s Stage size), and whether sound channels are to be exported. When you have finished setting options, click OK. b. In the Export dialog box, click the Export button. Enter a filename for the digital video file and click the Save button. c. An Alert box reminds you that screensavers should be turned off during the file export. Click OK to dismiss the alert and the export process begins. Tip
To stop an export that is in progress, press Command+. (period) (Ctrl+.).
Exporting frames as a video is one way of keeping your movie compact, by replacing several sprites with a single sprite. Exporting frames of your Director movie as a digital video offers all the advantages — and the disadvantages — associated with including digital video in your movies. It can increase the file size of your movie, but it can also reduce the file size if the video is replacing several large cast members with a single, more compact cast member. You should consider the file sizes of the original cast members versus a digital video before deciding to export frames as a video.
QuickTime VR One of the more exciting video technologies supported by Director is Apple’s QuickTime VR (QTVR) format. QTVRs come in three flavors: panoramas, objects, and scenes. Panoramas are 360-degree images that can be viewed from any point in the 360-degree field of view. QTVR objects are three-dimensional objects that can
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 227
Chapter 6 ✦ Using Digital Video
be rotated and viewed from any angle. Scenes can contain a series of panoramas and objects that are linked together in what are referred to as nodes. All three formats give the user control, enabling them to adjust the view at any time. You can also control the view with Lingo. QTVRs can add a level of realism to your movies that’s not possible with other virtual reality technologies. Technologies such as Virtual Reality Markup Language (VRML) render the three-dimensional images in real time, thereby limiting the amount of information those images can display, such as textures and lighting, due to system resources. Thus, VRML objects tend to contain far less detail and appear crude. QTVRs are created from actual photographs or high-end 3D authoring programs capable of creating very detailed photorealistic images. It’s also possible to combine several QTVRs — called a nodal movie — into a single movie and create hotspots that enable a viewer to jump from one scene to another. On the CD-ROM
A wonderful example of QuickTime VR used in Director comes on the CD-ROM. Check out the Riddle of the Sphinx game preview. Riddle of the Sphinx is a five CD-ROM game, created in Director, that has taken the folks at Omni International more than five years to create.
Director treats QTVR movies just as it would any other QuickTime digital video. You can set the same properties for a QTVR file as you would for a QuickTime video. QTVR movies have the same limitations as QuickTime video in that you need to take into consideration file size and the resources needed to play them back. In the following exercise, you import a multinode QTVR movie into Director, place it on the Stage, and set properties that enable the user to navigate from one node to another. Multinode QuickTime VRs are composed of several independent QTVR scenes that are linked together, enabling a user to navigate from one node (QTVR movie) to another. On the CD-ROM
In this exercise, you import the nodal.mov QTVR file into the nodal.dir movie, which is in the EXERCISE:CH06 (EXERCISE\CH06) folder. The QTVR file is located in the video folder, located in the same folder as the Director movie.
Building a Virtual Tour 1. Open the nodal.dir movie in Director and import the nodal.mov file that is in the video folder. Use the same process you would use when importing a QuickTime video. 2. Click on the Properties button in the Cast window to activate the Property Inspector, shown in Figure 6-22. The video cast properties window should be active; if not, click on the QuickTime tab. 3. In Normal view, set the Playback setting to Play Every Frame (No Sound). Set the Frame rate to Maximum (–2 in the List view). Disable Play Sound (because there is no audio), and check Show Controller to display the controller.
227
3486-6 ch06.f.qc
228
7/24/00
5:42 PM
Page 228
Part I ✦ Working with Director
Figure 6-22: The Property Inspector set to the QuickTime tab
4. Make the Cast Window active and choose the nodal.mov cast member. Drag the member onto the Stage and position it inside the opening provided for the movie. The Stage should look like the one shown in Figure 6-23. Figure 6-23: Drag the mouse in the VR window to view the scene.
5. Rewind the movie and play it. Drag inside the QTVR window to change the view. The scene will rotate in the direction that you are dragging the mouse. The cursor changes to an arrow when it encounters a hotspot. 6. Click when the cursor changes to an arrow, and the QTVR switches to another node. To get back to main node, click on the small screen that appears in each second-level node.
3486-6 ch06.f.qc
7/24/00
5:42 PM
Page 229
Chapter 6 ✦ Using Digital Video
Using the controller buttons (shown in Figure 6-24) you can also view hotspots, zoom in and out, and navigate back to the previous node. You can control all of these actions through Lingo, so that they occur without the user having to interact with the scene. CrossReference
You learn to use Lingo to control this same scene in Chapter 19.
Figure 6-24: Click the Show Hotspots button to display the active areas in the QTVR.
Director does not have any capability to edit or create QTVR files. You need to create them with an application such as Apple’s QTVR Authoring Studio, and then bring them into Director. You can assign an external editor that opens the file if it is double-clicked; however, the same editor will be opened for all other QuickTime videos in your movie. This could present a problem, because QTVR editors do not generally offer the same kind of functionality as a digital video editor.
Summary Using digital video in your Director movies can greatly enhance the quality of your multimedia applications. Carefully implementing digital video into your multimedia applications enables you to accomplish effects that would be very difficult, if not impossible, to achieve using another graphics medium. Before moving on to the next chapter, review the aspects of digital video that were covered in this chapter: ✦ Director supports the QuickTime 3 format on both the Macintosh and Windows platforms. ✦ Digital video cast members are always linked. Take care when moving the files and when distributing your movies; be sure to include the linked files. ✦ You can crop and scale a video cast member.
229
3486-6 ch06.f.qc
230
7/24/00
5:42 PM
Page 230
Part I ✦ Working with Director
✦ You can insert cue points into a digital video, which enable you to control the tempo of the movie. ✦ Director has several built-in behaviors that you can use to control a digital video. ✦ You can export selected frames in your Director movies as digital video files. ✦ Director supports Apple’s QuickTime VR technology. In the next chapter, you learn to add interactivity to your movies by using Director’s built-in behavior libraries.
✦
✦
✦
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 233
7
C H A P T E R
The Power of Behaviors
✦
✦
✦
✦
In This Chapter
I
nteractivity is critical to multimedia — without it, a multimedia application is little more than a self-running slideshow. Director 6.0 introduced a powerful new tool for adding interactivity to your movies: the behavior. Whether encapsulated in the Library Palette, or implemented via Lingo using the Behavior Inspector, behaviors make your buttons click crisply, control media within your movie, and even keep time for you.
What Are Behaviors? With behaviors, you can add interactivity to a movie without Lingo scripting. Later, in Chapter 11, you learn to create a few simple scripts in Lingo to: ✦ Jump to a target frame ✦ Loop on the current frame
Introducing Director’s Library Palette window Accessing prepackaged behaviors Creating interactive Director movies without scripting Using the Behavior Inspector to attach, create, and edit behaviors Attaching external casts to use thirdparty behaviors
✦ Move the playback head forward one frame ✦ Move the playback head back one frame ✦ Jump to a target marker (creating a marker is covered later in this chapter)
Sending messages from one behavior to another
✦ When you create these scripts in Chapter 11, you actually create behaviors — because a behavior is nothing more than a script or a page of code that includes event handlers (or subroutines) for events that occur in your movie. Director’s standard events are listed later in this chapter and are discussed in detail in Chapter 11.
✦
✦
✦
3486-6 ch07.f.qc
234
7/24/00
5:44 PM
Page 234
Part II ✦ Bringing It All Together
The scripted actions in the bulleted list that opens this chapter are simple examples of what you can accomplish with behaviors. Fortunately, you can add powerful scripts to your movies without programming in Lingo, using the dozens of prescripted behaviors that are shipped with Director. Director’s built-in behaviors are contained as a series of external cast libraries (such as interactive.cst, navigation.cst, QuickTime.cst, text.cst, and so on) that are stored in the Libs folder within the Director 8 folder on your hard drive. These prepackaged behaviors enable you to add interactivity to objects in your movie, just by clicking, dragging, and responding to a few simple prompts. Note
A well-written behavior doesn’t require modifications to its code in order to work in your program. That means you can attach behaviors to objects without writing a single line of code.
Accessing Director’s predefined behaviors All the predefined behaviors included with Director appear in the Library Palette window. You can display the Library Palette by choosing Window ➪ Library Palette. The purpose of this palette is to enable you to view and attach predefined behaviors to sprites in your movies. Using the Library Palette window, you can click, drag, and attach behaviors to objects in your movies, but you cannot edit or delete the original behaviors. When you drop a behavior from the Library Palette window onto an object, Director copies the behavior to the movie’s Cast window. That’s where you can view and edit the behavior, as you learn to do later in this chapter and throughout the Lingo sections of the book. Behaviors are grouped into several categories (Animation, Controls, Internet, Java Behaviors, Media, Navigation, and Text). Each category contains behaviors that are related to the action that the behavior was built to perform. Several categories — media, for example — are divided into subcategories that group the behaviors according to the aspects of the main category with which the behaviors were designed to work. The categories found on the Library Palette and the types of behaviors that are contained in them are: ✦ Animation. These behaviors are applied to sprites to perform numerous animation effects and can enable the user to manipulate sprites while the movie is playing. There are three types of animation behaviors: automatic, interactive, and transitions. • You use automatic animation behaviors to animate sprites automatically; although they can be triggered by another event, they don’t require any user interaction. Some of these behaviors are frame-based — the action happens over a series of frames in the Score. Others are time-based — the action happens over a specified period, regardless of the number of frames the sprite occupies in the Score.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 235
Chapter 7 ✦ The Power of Behaviors
• Interactive animation behaviors require some type of user interaction to trigger them. You use most of the behaviors in this section to manipulate sprites on the Stage while the movie is playing. For example, you can make a sprite “draggable,” enabling a user to drag the sprite to another location on the Stage. There are also several behaviors that detect the location of a sprite while it is being moved on the Stage and then determine whether it’s within the bounding box (referred to as the rect) of another sprite. • Sprite transition behaviors create transitions from one screen to another, using the new imaging Lingo feature introduced in Director 8. Many of these effects mimic ones found in programs such as Adobe Premiere, such as barn doors and soft-edge wipes. CrossReference
Chapter 26 goes into great detail about the new imaging Lingo commands introduced in Director 8.
✦ Controls. Controls contain a series of behaviors designed to add interactivity and user feedback to your movies. Most of the basic behaviors that are applied to buttons are found in this category. Also, several behaviors enable you to create a status bar and ToolTips to display custom messages. Last, but not least, one behavior is for building an analog clock that uses the internal clock on the user’s computer to correctly display the time. ✦ Internet. The Internet category (you guessed it) contains behaviors designed for building movies that primarily will be played over the Web. Three subcategories of behaviors are located here: Forms, Multi-user, and Streaming. The first two subcategories contain behaviors that are designed to enable your movie to interact with a Web server. The Streaming category contains behaviors that enable you to control the way Shockwave movies will download and play back over the Web. • The Forms subcategory contains behaviors for creating forms in your movies that the user can fill out. The data can then be sent to a Web server and used by other applications, such as a database. These behaviors are for advanced users and require a working knowledge of Web server applications. • The Multi-user subcategory contains behaviors for connecting to and disconnecting from a server. Also, several behaviors in the subcategory are for creating Shockwave “chat rooms,” which enable multiple users to communicate with each other over the Web. • The Streaming subcategory contains behaviors that control the way the media elements in a Shockwave movie download from the Web. You can use behaviors to display a progress bar showing the status of the movie as it is being downloaded. In addition, several behaviors enable you to loop a movie until the media elements that you defined have been downloaded.
235
3486-6 ch07.f.qc
236
7/24/00
5:44 PM
Page 236
Part II ✦ Bringing It All Together
✦ Java Behaviors. These are a collection of “Java-safe” behaviors that should be used if you will be outputting your Director movies as Java applets to be played over the Web. The Java behaviors are for advanced users and require a strong knowledge of Lingo. ✦ Media. You use the Media behaviors to control and add interactivity to Flash movies, QuickTime digital video, and audio that has been imported into your movies. The subcategories are divided according to the type of media that the behavior is designed to work with: Flash, QuickTime, or Sound. • You use Flash behaviors to add interactivity and control the playback size and quality of an entire Flash movie or individual Flash elements. • Use the QuickTime behaviors to create custom controls that will be used to play back a QuickTime movie. This subcategory contains a very useful behavior that you can use to create a custom VCR-like control panel that enables a user to control the way a QuickTime move is played. Another behavior enables you to create a custom slider bar that works the same way as the built-in controller that can be displayed with QuickTime video or audio movies. • Two Sound behaviors in this subcategory enable you play a linked or internal sound file. ✦ Navigation. You use the Navigation behaviors primarily in conjunction with the Control behaviors to determine where the movie will advance to when a user clicks on a sprite that contains a control behavior. Also, other behaviors control how long a movie loops on a particular frame. New Feature
Director now has a set of behaviors designed to create painting tools that enable users to paint on the screen while the movie is running.
✦ Paintbox. This new set of behaviors introduced in Director 8 is designed to create a painting application using Director. These behaviors control the basic functions needed to paint images on the screen, including selecting colors and brushes, erasing, and undoing an action. ✦ Text. Use these behaviors to format text as well as to create special effects with text, such as having the text appear to type automatically on the screen. Several behaviors in this category are for generating and displaying hypertext links for multimedia applications that will interact with the Web. Tip
If you momentarily hold the mouse over any behavior in the Library Palette, a ToolTip appears, giving a brief description of the behavior.
A detailed listing of all of the behaviors that ship with Director, as well as their uses, is in Appendix B, “Director’s Built-in Behaviors,” located at the back of this book.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 237
Chapter 7 ✦ The Power of Behaviors
You work with several of these behaviors in this chapter. In each case, the action listed in the Action column occurs when a specified event occurs. When you set up the use of a behavior, you get to specify the event that triggers it.
Attaching predefined behaviors to objects To use a behavior from the Behavior Library requires just a few steps. 1. First, be sure that the Library Palette window is visible by choosing Window ➪ Library Palette. The Library Palette window appears (shown in Figure 7-1) and displays the behaviors stored in a single predefined external cast library stored in the Libs folder.
Behavior icon Library list button Library category Figure 7-1: All of Director’s predefined behaviors are contained in the Library Palette.
Scroll triangle Resize window tab
2. If the desired behavior is not visible, you can view other behaviors by using the Library List button, which is identified in Figure 7-1. Simply click the button, drag until the desired behavior library name is highlighted (such as Animation, Navigation, Media, and so on), and then release the mouse button. The behaviors contained in the selected category are displayed in the window. If more behaviors exist than can be displayed simultaneously in the Library Palette window, a scroll triangle appears at either the bottom or the top of the palette. You can use the scroll triangle to scroll toward the beginning or end of the list of behaviors in the current behavior library. Resize the entire window by clicking on the tab in the lower right corner and dragging the window to the desired size.
237
3486-6 ch07.f.qc
238
7/24/00
5:44 PM
Page 238
Part II ✦ Bringing It All Together
Note
In Director 6, a single Behavior Library .cst file contained all the prepackaged behaviors. Once opened, you had to scroll through cast member after cast member to locate the specific behavior that you wanted. Director 8’s Library Palette window organizes behaviors by their function, making it easier to locate the desired behavior.
3. After you have located and displayed the desired behavior in the Library Palette, click the behavior’s icon (identified in Figure 7-1) to select it. 4. Drag and drop the behavior by its icon onto a sprite (on the Stage) or onto the target cell (in the Score window’s script channel). 5. Some behaviors require parameters, called properties, which define the action or designate a target for the behavior’s action. For example, you can attach a behavior to a button that causes the playback head to jump to a specific frame. To make the jump, the behavior must be told the name or number of the target frame. If additional information is required, a Parameters dialog box in which you must enter the properties for the behavior appears. After you enter the requested parameters, click OK to close the dialog box. A behavior can be attached only to a sprite on the Stage or to a frame in the Score window. Behaviors that are dropped onto a sprite are called sprite scripts. You can attach multiple behaviors to a single sprite on the Stage to create a more complex action. Behaviors dropped onto a cell in the Score window are considered frame scripts. You can attach only a single behavior to a frame’s script channel. Note
In their most essential form, behaviors are Score scripts. Score scripts, as well as other types of scripts, are discussed throughout the Lingo section of this book.
Building a Better Movie Director is the hands-down favorite among graphic designers for creating portfolios, resumes, and promotional pieces. Version 8 of the program is sure to increase its popularity, because it offers so many code-free options for creating highly interactive presentations. Using the built-in behaviors that come with Director in your movies enables you to add sophisticated interactive and animation components, easily control how a movie downloads over the Internet, and even create chat rooms and multiuser games. You can add all of these components to your multimedia applications with little or no Lingo programming experience.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 239
Chapter 7 ✦ The Power of Behaviors
Pushing all the right buttons When you get right down to it, creating an interactive interface boils down to creating buttons and then telling the program what to do when someone clicks them. It is these buttons, in fact, that make the interaction between user and application possible. With buttons, the graphical user interface (GUI) becomes more than simply a picture on the screen — it becomes a tactile experience. A good button invites the user to click it and serves to take the program’s illusion of reality one notch higher (see Figure 7-2). Figure 7-2: A well-designed button engages the user.
The exact definition of a button can vary widely, but for the most part includes these characteristics: ✦ A button is an object or spot on the screen that, when clicked, causes something to happen. ✦ A button typically simulates a real-life physical button, like those on an electronic appliance or computer. When you click the mouse on it, the button changes its appears (looks “raised” or “pressed”); when the mouse button is released again, the button returns to its former state (pressed or not pressed). This kind of button essentially transfers the physical action of the mouse click to the virtual action of a button click. ✦ A button may become highlighted (become brighter on the screen) or animated when the cursor moves over it, with or without the pressed appearance. ✦ A button can be rendered inactive so that it does not react at all to the mouse, and then be made active again when some external event takes place. Even though buttons are a staple of multimedia, they have always been notoriously difficult to pull off well in Director. Beginning with Director 6.x this has changed (and how!). Now you can implement buttons in three different ways: by employing standard system buttons on the Tool Palette, by using prepackaged behaviors (as shown in the next section), or by writing a navigational handler using Lingo. CrossReference
Chapter 14 discusses using Lingo to control a button’s behavior.
239
3486-6 ch07.f.qc
240
7/24/00
5:44 PM
Page 240
Part II ✦ Bringing It All Together
Using navigation behaviors to build buttons In the next few sections, you use Director’s predefined behaviors to accomplish some of the tasks that required Lingo scripting in prior versions of Director. To provide the user control over the flow of a movie, you must be able to put the playback head in a holding pattern on a specific frame and attach behaviors to buttons that, when clicked, forward the playback head to the next frame or a designated frame. Finally, you apply a behavior that sends a message to another sprite to trigger an animation. The Library Palette includes behaviors to accomplish these tasks, which you can drag and drop onto frames and sprites. To demonstrate this, you use the engine.dir movie for the exercises in this chapter. The engine.dir file is a partially built Director movie that simulates an interactive learning module that could be created as part of a multimedia application. Most of the cast members that will be used in this movie are already on the Stage. You will concentrate on adding behaviors to the sprites that will add the interactivity to the movie. When you look at the Score window, it is difficult to verify the names of cast members upon which each sprite is based, because almost all sprites in the movie are one frame in duration. To display the name for each sprite, you should make the Score the active window and move the mouse pointer over the sprite in question. If you leave the pointer there momentarily, a ToolTip appears, showing the sprite’s name. You can also determine the name and appearance of a sprite by clicking on its cell in the Score window, which causes a thumbnail of the cast member to appear in the upper-left corner of the Score window along with the sprite’s name, as shown in Figure 7-3. You can also assign a color to cells in the Score to make it easier to identify sprites. Simply select the cells in the Score to which you want to apply a color, and then click on a color swatch located in the lower-left corner of the Score window.
Tip
In the following exercise, you initially test the movie to determine whether it plays from the first frame to the last without pausing. Next, you open the Library Palette window with prescripted behaviors and add a behavior to the movie that causes it to pause and loop on frame 1. Note
On the CD-ROM
When you apply a behavior to a sprite from the Library Palette, the behavior is copied to the current cast window. For this exercise, you use a partially complete director movie (engine.dir) available on the companion CD-ROM in the EXERCISE:CH07 (EXERCISE\CH07) folder. You will be asked to save this movie to your hard drive at the end of this exercise so that you can add features to it in the other exercises in this chapter.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 241
Chapter 7 ✦ The Power of Behaviors
Sprite thumbnail image
Sprite label Cell color swatches Figure 7-3: The Score window with a thumbnail of a sprite displayed.
Using a Behavior to Loop on the Current Frame 1. Open the engine.dir movie. 2. Be sure that the Score and Stage windows are visible. The Score will appear similar to Figure 7-3. 3. Rewind and play the movie. It plays from start to finish without stopping ( and may loop if the Control Panel Loop Playback button is selected. You see certain elements flashing on and off, which happens because some sprites are used only on single frames, while others (like the background sprite) are used in all of the frames of the movie. 4. Stop the movie and rewind it. 5. If the Library Palette window is not visible, click the Library Palette button on the toolbar or choose Window ➪ Library Palette. 6. When the Library Palette window appears, click the Library List button. When the pop-up list appears, select the Navigation category. 7. Locate the Hold on Current Frame behavior in the list of available behaviors, and then drag and drop it onto the Script channel in frame 1 of the Score window, as shown in Figure 7-4.
241
3486-6 ch07.f.qc
242
7/24/00
5:44 PM
Page 242
Part II ✦ Bringing It All Together
Script channel
Figure 7-4: Drag the Hold on Current Frame behavior to the script channel in frame 1.
8. Save the movie as engine1.dir. 9. Rewind the movie, close all open windows, and then play the movie. Tip
You can temporarily close all windows and play a movie if you hold down the Shift key and press Enter on the numeric keypad.
The engine1.dir movie now holds on the first frame of the movie. You can click the Next Screen, Enable Sound, and Launch Rocket buttons, but nothing happens in your movie . . . yet! 10. Stop the movie and rewind it. The Hold on Current Frame behavior accomplishes a single task: It causes the playback head to loop on the current frame until another event instructs the playback head to move on. It can be instructive to examine the script that causes this behavior to function. You’ll do that later in this chapter. At this point, the engine1.dir movie is waiting on the first frame for some kind of instruction that will tell it to proceed to the next frames of the movie. In the following steps, you attach the Go to Frame behavior to the Next Screen button and thus enable the playback head to escape from the frame 1 loop.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 243
Chapter 7 ✦ The Power of Behaviors
Attaching a Behavior to Jump to a Specific Frame 1. Be sure that the engine1.dir movie and the Library Palette window are both open. 2. Locate the Go to Frame X behavior in the Library Palette window (it’s in Navigation group of behaviors). 3. Drag and drop the Go to Frame X behavior onto the Next Screen button sprite (colored yellow in the Score window) located in sprite channel 5. Because this behavior (unlike the Hold on Current Frame behavior) includes properties, the Parameters dialog box appears, as shown in Figure 7-5. You must specify the destination frame. Figure 7-5: Enter the frame number to which you want the movie to advance when a user clicks the button.
4. Enter 5 next to the Go to which frame on mouseUp prompt. Then click the OK button to return to Director’s main window. 5. Save the movie as engine2.dir, and then rewind and play the movie. 6. Click the Next Screen button to test the Go To Frame behavior. If the Loop Playback button on the Control Panel is turned off (so that the movie does not loop), the movie will jump to frame 5 and continue playing until the end. You need to add another Hold on Current Frame script to have the movie loop on frame 5. 7. To cause the movie to loop on frame 5 rather than automatically terminating, open the Cast window and drag the Hold on Current Frame behavior to the script channel in frame 5. This creates a copy of the behavior in frame 5. Caution
It’s possible to copy and paste a script; however, it’s generally not a good idea. If the behavior that you are copying has parameters applied to it, the same parameters will be applied to the new sprite or Score channel onto which it has been pasted. It’s usually safer to reapply a behavior that has parameters connected with it to the new sprite so that new parameters can be set for it. It is far safer to drag and drop a behavior from either the Cast window or the Library Palette into the Score window’s Script channel.
8. Save the movie again as engine2.dir, and then rewind and play the movie. After testing the Next button, stop the movie. The movie now loops on frame 1 until the Next Screen button is clicked, and then it advances to frame 5 and loops on that frame. The Next Screen button appears to be dimmed out. Because this button is no longer needed, a blend was applied to it to make it appear to be inactive.
243
3486-6 ch07.f.qc
244
7/24/00
5:44 PM
Page 244
Part II ✦ Bringing It All Together
Using the Behavior Inspector The Behavior Inspector, introduced with Director 6, provides a means for you to view and edit existing predefined behaviors and to create new ones in a cast. You cannot modify or delete behaviors in the Library Palette window, but you can view, edit, delete, or create a behavior in the Cast window. The Behavior Inspector, shown in Figure 7-6, provides easy access to information about the behavior, including the behavior’s name, type, its script, its description, the names and values of any parameters (properties) associated with the behavior, and the span of frames to which the Behavior is applied. You open the Behavior Inspector by choosing Window ➪ Inspectors ➪ Behavior Inspector or by pressing Command+Option+; (Ctrl+Alt+;).
Add behavior button Clear behavior button
Parameters button Script button
Editing pane
Description pane
Number of frames the behavior spans Sprite channel Behavior type Figure 7-6: The Behavior Inspector with both the editing and description panes expanded.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 245
Chapter 7 ✦ The Power of Behaviors
The Behavior Inspector is built on a series of panes that can be collapsed or expanded as needed. In its default state, these panes are hidden. You click the two triangles on the left side of the Inspector to expand or collapse the panes. You’ll get a good look at these panes as you work through these sections. The Editing Pane contains the Events and Actions pop-up button. The Description Pane displays a description of what the behavior does; this may include information about properties and their roles, events that the behavior generates, and copyright information. At the top of the Behavior Inspector is the gear-shaped Parameters button, which opens the behavior’s Parameters dialog box. From it, you can change the behavior’s properties. The Script button, located next to the Parameters button, enables you to view and directly modify the Lingo script that is used for the behavior. At the bottom of the Behavior Inspector, you see the type of behavior, the sprite channel in which it’s located, and the span of frames to which the behavior has been applied. A button located in the lower-left corner of the window locks the currently selected behavior so that it is displayed no matter what sprite is chosen. This is useful if you need to view all of the properties that are applied to a series of sprites, although it can cause confusion, because there is no indication of what the displayed behaviors are applied to.
Viewing the script behind a behavior In Chapter 11, you explore the Script window and begin learning the basics of programming using Lingo, Director’s proprietary scripting language. For now, it’s helpful to glimpse behind the façade of the behavior and simply be aware that it’s just a series of instructions. By default, when you double-click on a behavior in the Cast window (either an internal or external cast), the Behavior Inspector opens so that you can edit it. You can change the default setting so that the Script window pops up rather than the Behavior Inspector. As you become proficient in Lingo scripting, you may prefer to have the Script window appear instead of the Behavior Inspector — although for now, the Behavior Inspector is more useful as you learn and experiment with codeless programming. To change which window appears for viewing or editing a behavior, you can choose File ➪ Preferences ➪ Editors. After the Editors Preferences dialog box appears, select Behavior from the list and click the Edit button. When the Select Editor for Behaviors dialog box appears, you can choose between the Script Window radio button or the Behavior Inspector radio button, and then click the OK button. Finally, click the OK button to close the Editors Preferences dialog box. For the duration of this lesson, we’ll assume that you have established the Behavior Inspector as the default editor for behaviors.
245
3486-6 ch07.f.qc
246
7/24/00
5:44 PM
Page 246
Part II ✦ Bringing It All Together
You can open the Behavior Inspector by using one of several methods: ✦ You can use the shortcut keys Command+Option+; (semicolon) on the Macintosh or Ctrl+Alt+; (semicolon) for Windows. ✦ You can click the Behavior button in the top-left part of the Score window (see Figure 7-7) or on the Director toolbar.
Figure 7-7: Open the Behavior Inspector by clicking on the Behavior icons located in the Score window or on the toolbar.
Director 8 introduces a stripped down version of the Behavior Inspector, shown in Figure 7-8, that is included in the new Property Inspector window. The primary purpose of the Behavior tab is to view and modify the parameters of the behavior that are applied to a sprite. The version contained in the Property Inspector does not contain the description window or the tools needed to create a new behavior. You can open the Behavior tab located in the Property Inspector by using one of two methods. ✦ If the Sprite Overlay is visible, you can click the Behavior icon (identified in Figure 7-7) to display the Behavior tab in the Property Inspector. ✦ Click on the Behavior tab in the Property Inspector when editing other properties of a sprite that has behaviors attached to it.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 247
Chapter 7 ✦ The Power of Behaviors
Figure 7-8: The Property Inspector contains a “stripped down” version of the Behavior Inspector.
What’s the Sprite Overlay? When you click on a sprite to make it active, the Sprite Overlay appears with three icons: the Cast Member Properties icon, the Sprite Properties icon, and the Behavior Inspector icon. Clicking the Behavior Inspector icon opens the Behavior Inspector. You can toggle the Sprite Overlay between being visible and invisible by choosing View ➪ Sprite Overlay or by using these keystrokes: Ctrl+Shift+Alt+O (Windows) or Command+Shift+Option+O (Mac). This feature provides a summary of information on the currently selected sprite.
Tip
Caution
Dissecting someone else’s script or behavior can help you learn Lingo, but don’t change the behaviors until you understand what you are doing. A small change can cause a behavior not to function as intended.
In the next exercise, you open a behavior and display its “guts” using the Script window.
Examining the Hold on Current Frame Behavior 1. Open the engine2.dir movie that you modified in the preceding exercise. 2. Double-click the Hold on Current Frame behavior in the Cast window, and either the Script window or the Behavior Inspector appears. If the Behavior Inspector appears, click the Script button, identified in Figure 7-6, to display the Script window. 3. Use the scroll bar to scroll to the top of the script.
247
3486-6 ch07.f.qc
248
7/24/00
5:44 PM
Page 248
Part II ✦ Bringing It All Together
4. Review the script — and don’t panic over its initial complexity. Some of the script is composed of comments, that is, lines of text preceded by the double dash (--), as shown in Figure 7-9. When you examine the essence of this behavior (that is, the uncommented lines), it is composed of three lines, with its “heart” being a go the frame instruction).
Figure 7-9: The text of the Hold on Current Frame behavior script with the getBehaviorDescription instruction indicating that no parameters are required for this behavior.
5. Close the Script window and the Behavior Inspector.
Adding behaviors by using the Property Inspector You already know how to drop and drag a behavior onto a sprite, but you can also add a behavior to sprites by means of the Property Inspector. Unless you are creating a new Behavior — you do that later in this chapter — it saves time to add behaviors using the Property Inspector because you probably already have it open in order to adjust other properties in your movie. To do so, you need to: 1. Open the Library Palette by choosing Windows ➪ Library Palette. Select the behaviors that you want to use in your movie, and then drag them into the Cast window. 2. On the Stage, select a sprite to which you want to apply a behavior.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 249
Chapter 7 ✦ The Power of Behaviors
3. Click the Behavior button on the Sprite Overlay. This launches the Property Inspector with the behavior tab active. 4. Choose a Behavior from the Behavior Pop-up button, as shown in Figure 7-10.
Behavior pop-up button Parameters button Script button Figure 7-10: The Property Inspector enables you to apply behaviors to sprites. You can also easily modify the parameters of the applied behavior.
Parameter listings Parameter settings
5. If the behavior you applied has parameters that need to be set, a menu appears, prompting you to choose them. After they have been set, the parameters are listed in the lower pane of the window. The parameters can be adjusted at any point during the creation process either by clicking the small arrow next to the parameter listing and choosing a new parameter setting from the pop-up menu, or by clicking on the Parameters button to display the Parameters dialog box. Note
While the Property Inspector is open, you can repeat the process and attach additional behaviors to the selected sprite on the Stage.
6. When you have finished adding properties to the selected sprite, you select another sprite on the Stage to edit, and then add behaviors to it. When you are finished adding behaviors, either close the Property Inspector or leave it “floating” open on your desktop.
249
3486-6 ch07.f.qc
250
7/24/00
5:44 PM
Page 250
Part II ✦ Bringing It All Together
Adding behaviors in the Score window In most situations, the fastest way to add behaviors to sprites is through the Score window. Usually when you are creating a movie in Director, you place all of the cast members on the Stage and position them, and then switch to the Score window to adjust the sprite span, add keyframes, and so on. The next logical step in the process is to add the behaviors to the sprites. Director enables you to do this without having to open the Property or Behavior Inspectors. Adding behaviors in the Score window doesn’t enable you to see the parameters that you have set; however, you can always view and adjust them at any time by using the Property or Behavior Inspectors. Follow these simple steps to add behaviors in the Score window: 1. Open the Score window and select a sprite. 2. Click on the Behaviors pop-up menu, shown in Figure 7-11, and choose from one of the available behaviors displayed in the list that are in your Cast windows. 3. If any parameters need to be set, a menu appears, prompting you to set them.
Behavior inspector button Behavior pop-up Figure 7-11: Applying a behavior to a sprite in the Score window
You can also clear all the behaviors applied to a sprite or create a new behavior. You can also click on the Behavior Inspector button in the Score window to launch the Behavior Inspector.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 251
Chapter 7 ✦ The Power of Behaviors
Caution
Clicking the New Behavior option in the Score window pop-up menu launches the Script window, not the Behavior Inspector. This occurs even if you have chosen the Behavior Inspector as your default editor for behaviors.
Removing behaviors from a sprite If you change your mind, you can also use the Property Inspector to remove one or more behaviors. To delete a behavior, you must: 1. Locate and select the sprite on the Stage (from which you want to remove a behavior). 2. Click on the Behavior button located in the Sprite Overlay. 3. In the Behavior tab of the Property Inspector, click to highlight the behavior in the Behavior List pane, as shown in Figure 7-12.
Clear behavior button
Shuffle down
Shuffle up Selected behavior
Figure 7-12: The Property Inspector with multiple behaviors listed
4. Press the Clear Behavior button and choose the Remove Behavior option. You can also delete a selected behavior by pressing the Backspace or Delete key.
251
3486-6 ch07.f.qc
252
7/24/00
5:44 PM
Page 252
Part II ✦ Bringing It All Together
You can also delete all of the behaviors applied to a sprite by choosing the Remove All Behaviors option in the Clear Behavior pop-up menu.
Tip
Reordering behaviors attached to a sprite Behaviors are executed in the order in which they were originally attached to the sprite, unless you specifically change the order. To modify the execution order, you need to change the order in which behaviors are listed in the Behavior List pane in the Property Inspector or Behavior Inspector. To change the order of execution, using the Property Inspector, complete these steps: 1. Open the Property Inspector and click on the Behavior tab. 2. Locate and select the sprite on the Stage to which the behaviors are applied that you want to reorder. 3. In the Behavior List pane of the Property Inspector, highlight the behavior that you want to reorder. 4. After selecting it, click either the Shuffle Up or Shuffle Down arrow, which are identified in Figure 7-12, until the behaviors are listed in the desired execution order. In the following exercise, you add a second behavior to the Next button in the engine2.dir movie that you saved to your hard drive, and then you reorder the sequence in which the behaviors are executed. On the CD-ROM
In the next exercise, you use the engine2.dir movie you saved earlier in this chapter. You can also use the engine2.dir movie found on the CD-ROM in the EXERCISE:CH07 (EXERCISE\CH07) folder.
Adding Media Behaviors to a Movie 1. Open the engine2.dir movie. 2. Make sure the Cast window is open. Open the Library Palette window. 3. From the Library List pop-up menu, select the Sound subcategory under the Media category. Note
You need to drag behaviors located in the Library Palette into the Cast window before you can use the Behavior or Property Inspectors to apply them to a sprite.
4. Drag the Sound Beep behavior into the Cast window (see Figure 7-13). 5. Open the Score window and set the playback head to frame 1, and then click on the Next Screen button on the Stage.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 253
Chapter 7 ✦ The Power of Behaviors
Figure 7-13: Drag the Sound Beep behavior from the Library Palette to the Cast window.
6. Click the Behavior button on the Sprite Overlay, and then select the Sound Beep behavior from the Behavior pop-up button in the Property Inspector. 7. Save the movie as engine3.dir. Rewind the movie and play it back. Click the Next Screen button. You will not hear the system beep, because the first behavior (go to frame 5) is executed before the second behavior’s actions can occur (Sound Beep). 8. Stop and rewind the movie. 9. Select the Next Screen button on the Stage, open the Property Inspector, and click on the Behavior tab if it is not already open. The Inspector should display the two behaviors attached to the Next button sprite. 10. In the Property Inspector, select (highlight) the Sound Beep behavior, and then click the Shuffle Up arrow. 11. Save the movie again. Rewind the movie and play it. 12. Click the Next Screen button; you will hear a system beep before the movie advances to frame 5. 13. Stop the movie. In the next few steps, you remove the behavior that plays a system beep and replace it with a behavior that plays an internal sound cast member (Click). You use the Property Inspector to accomplish these tasks.
253
3486-6 ch07.f.qc
254
7/24/00
5:44 PM
Page 254
Part II ✦ Bringing It All Together
CrossReference
Chapters 5 and 18 provide detail on importing sound, using sound channels, and controlling sound using Lingo. For now, enjoy the simplicity of using a behavior to add a sound to your movie.
Attaching and Deleting Media-Control Behaviors Using the Behavior Inspector 1. Open the engine3.dir movie that you saved in the preceding exercise and rewind it to frame 1, if necessary. Make sure the Cast window is open. 2. Open the Library Palette and select the Sound subcategory to display the Sound behaviors. Drag the Play Sound Member behavior into the Cast window. 3. Click the Next Screen button on the Stage and then click the Behavior button on the Sprite Overlay to open the Behavior tab in the Property Inspector. The two behaviors previously attached to the Next button sprite are displayed in the window. 4. Activate (click) the Sound Beep behavior. 5. Press Delete or Backspace to remove the highlighted behavior. 6. Click the Behavior pop-up button and select the Play Sound Member behavior. 7. The Parameters dialog box for the behavior appears, as shown in Figure 7-14. You must specify (from a list of possible settings) the sound to be played, the sound channel to use, the initializing event, and how many times the sound should loop. You set these options in the following steps.
Figure 7-14: The Parameters dialog box for the Play Sound Member behavior
8. The movie’s internal cast includes two sounds (Click and Audio Track). By default, the Sound to Play field (shown in Figure 7-14) lists the Click cast member, which is the first sound cast member in your movie. If you click on the Sound pop-up menu button, you’ll see all the sound cast members available in the current movie. 9. Leave the Sound Channel field set to 1 and the When to Play Sound field set to when the mouse clicks on the sprite (a friendly term for mouseDown). Leave the Number of Loops parameter set to 1 so that the sound will play only one time.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 255
Chapter 7 ✦ The Power of Behaviors
10. Click OK to accept the current parameters and attach the behavior to the Next button sprite. 11. In the Property Inspector, make sure the Play Sound Member behavior is listed as the first behavior. If not, select the behavior and click the Shuffle Up arrow to cause it to be listed (and executed) first. 12. Save the movie as engine4.dir. 13. Close all windows. Rewind and play the movie. 14. Click Next, and you hear the Click sound cast member play; then the movie advances to frame 5. 15. Stop the movie and rewind it. In the following exercise, you use the drag-and-drop method to attach the Play Sound Member behavior to the Enable Sound button on the Stage. You can use this method to attach any of the behaviors in the Behavior Library Cast.
Dragging and Dropping a Media Behavior onto a Sprite 1. Open the engine4.dir movie that you created in the last exercise. Rewind the movie if needed. 2. With the Cast window open, locate the Play Sound Member behavior. 3. Drag and drop the Play Sound Member behavior onto the Enable Sound button on the Stage. 4. When the Parameters dialog box appears, which is similar to the one shown previously in Figure 7-14, you must specify the desired settings. 5. Choose the AudioTrack sound from the Sound to Play? pop-up menu. 6. Set the Sound Channel field to 2 and the When to Play Sound field to when the mouse is released over the sprite (a friendly term for mouseUp). You want the AudioTrack to play in sound channel 2 because the Click sound that you selected for the Next Screen button will play in sound channel 1. Set the Number of loops parameter to 0, which enables the member to loop indefinitely. Caution
Only one sound at a time can play in each sound channel. If you had specified sound channel 1 for the AudioTrack member, it would stop playing when the Next Screen button is clicked.
7. Click OK to finish setting the parameters for the behavior attached to Enable Sound sprite. 8. Save the movie as engine5.dir.
255
3486-6 ch07.f.qc
256
7/24/00
5:44 PM
Page 256
Part II ✦ Bringing It All Together
9. Close all windows. Then rewind and play the movie. Click the Enable Sound button, and the AudioTrack cast member plays when the mouse button is released. The click sound also plays if you click the Next Screen button. 10. Stop the movie and rewind it. You could have set the AudioTrack member property to loop instead of setting it with the parameter in the Play Sound Behavior. Setting the looping parameter in the behavior gives you more flexibility than setting the cast member property to loop, because you can use it in other places in the movie without having the sound loop. Caution
Setting a loop in the Play Sound Parameter can have very unexpected results if the member’s looping property has also been set. Use one or the other.
Using the interactive behaviors In addition to navigational and media behaviors, Director includes prescripted interactive animation behaviors. These behaviors alter the appearance of sprites on the Stage. In the following exercise, you add the Rollover Member Change behavior to the engine5.dir movie, which changes the appearance of a specific sprite when the mouse pointer rolls over it. In this example, three parts of the rocket engine (the Oxygen Tank, the Mixing Chamber, and the Hydrogen Tank) will highlight and display a label describing the specific engine part. The sprites are located in channels 11, 12, and 13 of frame 5 of the Score, and are named O2, mix, and hydro. On the CD-ROM
You can find the file engine5.dir on the companion CD-ROM in the EXERCISE:CH07 (EXERCISE\CH07) folder. You also can use the engine5.dir movie that you created in the preceding exercise in this chapter. You also use the Rollover Member Change behavior, which is in the Library Palette.
Adding a Behavior That Swaps One Sprite for Another 1. Open the engine5.dir movie. In the Score window, move the playback head to frame 5. Note that there are three sprites (in channels 11, 12, and 13) that are colored light blue. These are the sprites to which you will apply the Rollover Member Change behavior. 2. Be sure the Library Palette is open. Then choose Animation ➪ Interactive from the Library List pop-up menu. Locate the Rollover Member Change behavior. 3. Drag and drop the Rollover Member Change behavior from the Library Palette onto the O2 sprite, located on frame 5 in Sprite channel 11 of the Score, as shown in Figure 7-15.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 257
Chapter 7 ✦ The Power of Behaviors
02 Sprite
Rollover member change behavior
Figure 7-15: You can drag a behavior from the Library Palette directly onto a sprite in the Score window.
4. When the Parameters dialog box appears, the cast member that is displayed in the cast member selection pop-up menu is called O2 on. This parameter always displays the next available cast member in the Cast window. Because the O2 on cast member is the one you want, click OK to return to Director’s main window. 5. Select the sprite in channel 12 (mix) and apply the Rollover Member Change behavior, using the behavior pop-up menu in the Score window. Select mix on as the rollover member. Repeat this step for the hydro sprite in channel 13, using hydro on as the rollover member. 6. Save the movie as engine6.dir. 7. Close all windows, and play the movie. If you rewound the movie, click on the Next Screen button to advance to frame 5. 8. Move the mouse pointer over the engine parts on the rocket. Each part becomes highlighted and a label describing the part appears. 9. Stop the movie.
257
3486-6 ch07.f.qc
258
7/24/00
5:44 PM
Page 258
Part II ✦ Bringing It All Together
Creating complex rollover cast members The effect created in the preceding exercise required some planning before the elements were brought into Director. By default, Director sets the registration point to the center of a cast member’s bounding box when it is imported into the program. Because the rollover cast members are larger than the ones that are on the Stage, they would have appeared to jump when you rolled over them with the cursor. I could have reset the registration point of the rollover cast members in the Paint window, but this would have been very time-consuming. The easier solution was to add the connecting lines and text labels to the cast members after importing them into Director using the Paint window. This technique assured that the registration point would be exactly the same for both the original and rollover cast members because they were the same exact size when they were imported into Director. The labels had to be created at some point in the process, so adding them in the Paint window after importing them into Director added no time to the process of creating the graphics, yet saved quite a bit time in Director by not having to manually re-register them.
Creating Your Own Basic Behaviors To this point, you have used the Behavior and Property Inspectors to add, remove, and view the behaviors attached to a specific sprite. You can also use the Behavior Inspector to create simple behaviors and still avoid the need to script or program interactivity from scratch. Tip
The Behavior Inspector operates similarly to a macro editor, where specific choices you make are converted to the required Lingo code. As you use the Behavior Inspector to create new behaviors, you may be tempted to examine the scripts that are generated — which is a good learning technique — but you probably want to read Chapter 11 first. You can learn a great deal by observing how the Behavior Inspector translates your choices into basic Lingo functions.
The process required to create a new behavior varies depending on the nature of the behavior. In general, you must complete these steps: 1. Open the Behavior Inspector by choosing Window ➪ Inspectors ➪ Behavior Inspector, or by clicking the Behavior Inspector button in the toolbar or Score window. 2. Click the Behavior pop-up button and select the New Behavior option. 3. When the Name Behavior dialog box appears, as shown in Figure 7-16, enter an appropriate, descriptive name for the behavior, and click OK. Figure 7-16: The Name Behavior dialog box
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 259
Chapter 7 ✦ The Power of Behaviors
Note
When you create a new behavior, it is stored either in the currently selected empty cast slot or in the next empty cast position, if the current slot is occupied.
4. If the editing pane is not visible, click the upper arrow to expand the Editing pane for the Behavior Inspector (identified in Figure 7-17). Note
The top arrow alternately contracts and expands the Editing Pane. The bottom arrow, identified in Figure 7-17, alternately expands and contracts the Description pane. The Editing pane displays the events and actions included in the current behavior. No events or actions appear when you first begin to create a new behavior.
Event pop-up button
Shuffle down
Shuffle up
Event pane (events & actions) Expand/Collapse pane
Description pane
Figure 7-17: The Behavior Inspector with the Editing and Description panes expanded
5. At this point, you can add events to the behavior by using the Event pop-up button and add actions by using the Action pop-up button. Each time you add an event, you must add a corresponding action (that occurs in response to the event). You can assign more than one action to each event. Note
The Actions available from the Action pop-up menu are grouped into six categories: Navigation, Wait, Sound, Frame, Sprite, and Cursor. A seventh option, New Event, enables you to create a new, user-defined event. This feature requires that you know how to create scripts using Lingo.
259
3486-6 ch07.f.qc
260
7/24/00
5:44 PM
Page 260
Part II ✦ Bringing It All Together
Tip
You can use a similar process to edit events and actions assigned to an existing behavior. Simply highlight the behavior, select the event from the list, and then add new actions or delete any existing actions from the actions list. To delete an event or action, select it and then press the Delete or Backspace key.
6. You can alter the sequence of actions within a behavior by using the Shuffle Up and Shuffle Down arrows just above the Editing pane. 7. When you have finished adding events and their corresponding actions, you can close the Behavior Inspector (or leave it open) and save your movie — which now includes the newly defined behavior. Unfortunately, there is no way to add a description to a behavior without having to resort to Lingo. Note
As you become familiar with Lingo (starting in Chapter 11), you’ll discover that the Behavior Inspector provides a transparent way of creating Lingo code. The syntax of event names in the Behavior Inspector is similar to the Lingo code used for these behaviors (Mouse Up = mouseUp, for example).
To get good at building your own behaviors, you need to understand what types of actions generate each event. The Event found in the pop-up menu and the actions that generate them are listed in Table 7-1.
Table 7-1 Standard Events Event
Action That Generates the Event
MouseUp
Occurs when the left mouse button is released after being pressed (clicked). It is called only once, and only if the mouse button is released while within the active area of a sprite (see MouseWithin).
MouseUp
Occurs when the left mouse button is pressed (clicked) but not released. Generally, it’s better to assume that the user has not made a selection (such as clicking on a menu item or button) until the mouse button is released. This gives users a chance to move the mouse pointer off an object if they have inadvertently pressed the mouse button over the wrong object.
MouseEnter
Occurs when the cursor moves into the active area of a sprite. This event is generated only once upon each entry into the sprite, after which MouseWithin events are generated. This is a good point at which to display highlight states for a button, write out status messages, call pop-up menus, and so forth.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 261
Chapter 7 ✦ The Power of Behaviors
Event
Action That Generates the Event
MouseWithin
Occurs repeatedly while the cursor is within the active area of a sprite (that is, in the sprite’s bounding rectangle, unless the sprite is displayed with Matte ink). The actions generated by this event should be short and to the point, because when you write a script that traps (responds to) this event, it can slow system performance if the mouse stays within a sprite’s area for a prolonged period of time.
MouseLeave
The cursor moves out of the active area of a sprite; this is the only time this event is called. It’s a good point at which to set highlight states for buttons back to their base states, revert status messages to the background message, hide pop-up menus, and so forth.
KeyUp
Occurs each time a key is pressed and released. Works only for controls that have text field components, and only if the control currently has the focus. See Chapter 14 for more information about text fields.
KeyDown
Occurs each time a key is pressed but not released. Only works for controls that have text field components and only if the control currently has the focus. See Chapter 14 for more information about text fields.
RightMouseUp
Occurs when the right mouse button is released. This obviously applies primarily to Windows-based machines, because Macintosh mice have only one button. To simulate a mouse right-click on the Macintosh, Control+click.
RightMouseDown
Occurs when the right mouse button is pressed. This obviously applies primarily to Windows-based machines, because Macintosh mice have only one button. To simulate a mouse right-click on the Macintosh, Control+click.
PrepareFrame
Occurs after the playback head exits a frame and prior to the next frame being painted on the screen. This is a good place to check to whether a visible sprite needs to be invisible or vice versa.
ExitFrame
Called after the frame has been drawn and all sprites have been tested for events. This is a good point for navigating to different frames.
BeginSprite
Occurs when the playback head moves to a frame that contains the first instance of the sprite. This event occurs only once, even if the playback head is looping on the frame. Continued
261
3486-6 ch07.f.qc
262
7/24/00
5:44 PM
Page 262
Part II ✦ Bringing It All Together
Table 7-1 (continued) Event
Action That Generates the Event
EndSprite
Occurs when the playback head leaves the last frame containing the sprite and moves to a frame where the sprite no longer exists. The event is generated after exitFrame.
NewEvent
Gives you the ability to create a customized event handler for the behavior. Using this feature requires that you know how to script using Lingo and how to create a user-defined handler, which is explained later, in the Lingo section of this book.
Creating a New Behavior In the following exercises, you create a new behavior and then attach it to the Enable Sound button in the engine6.dir movie (after deleting a prepackaged behavior that plays a click sound when you click on the button). The new behavior applies the Add Pin ink to the sprite, making it appear to be highlighted when the mouse clicks on it and then reverses the ink back to the copy ink when the mouse button is released. The new behavior also plays the Click sound. You then add a mouse leave event that resets the sprite if the mouse rolls off the button before it is released. On the CD-ROM
The file engine6.dir is on the companion CD-ROM in the EXERCISE:CH07 (EXERCISE\ CH07) folder. Alternatively, you can use the version that you saved in the preceding exercise.
Building the mouseDown event 1. Open the engine6.dir movie and rewind it. 2. Click on an empty cell in frame 1 to deselect all sprites in the movie, or click an empty slot in the Cast window. Now open the Behavior Inspector. Caution
If a sprite is selected when you create a new behavior, the behavior will be applied to the sprite automatically.
3. If the Editing pane is not expanded, click the top arrow to expand it. The Behavior Inspector should appear empty, like the one shown in Figure 7-18. Tip
You can also resize the panes of the Behavior Inspector. To do so, move the mouse pointer to the horizontal lines (pane dividers) that divide the panes. When the cursor changes to a double-headed arrow (a resizing cursor), drag up or down to resize the pane.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 263
Chapter 7 ✦ The Power of Behaviors
Pane dividers Figure 7-18: You can drag the pane dividers to resize the panes of the Behavior Inspector.
4. Click the Behavior pop-up button and select the New Behavior option. 5. When the Name Behavior dialog box appears, change the default behavior name to Better Button and click OK. 6. Click the Events pop-up button and select the Mouse Down option so that the Events pane matches Figure 7-19. Figure 7-19: Attaching the mouseDown event to the Better Button behavior
263
3486-6 ch07.f.qc
264
7/24/00
5:44 PM
Page 264
Part II ✦ Bringing It All Together
7. Click the Action pop-up button and then choose Sprite ➪ Change Ink. 8. When the Specify Ink dialog box appears, select the Add Pin ink effect from the pop-up menu, as shown in Figure 7-20. You’ll need to scroll down the list to find the Add Pin option. When the option is set, click OK to close the dialog box. Figure 7-20: Choose Add Pin for the Change Ink option.
9. To add a second action to the mouseDown action, click the Action pop-up button and choose Sound ➪ Play Cast Member. 10. When the Specify Sound Cast Member dialog box appears, set the Play Sound setting to Click, as shown in Figure 7-21. Next, click OK to close the dialog box. 11. Save the movie as engine7.dir. Figure 7-21: Choose Click for the sound cast member.
In the next exercise, you add a new event/action to the behavior, which causes the ink for the button to be reset to Copy on the Mouse Up action (when the user releases the mouse button).
Creating the mouseUp Event and Action 1. Open the engine7.dir movie, and double-click on the Better Button behavior in the Cast window to activate the Behavior Inspector. 2. Click the Events pop-up button, and select the mouseUp option. 3. Click the Action pop-up button, and choose Sprite ➪ Change Ink. 4. When the Specify Ink dialog box appears, make sure the Ink effect is set to Copy, and then click OK to close the dialog box. 5. With the Behavior Inspector still open, select the Enable Sound button sprite on the Stage. Click the Behavior pop-up button, and select the Better Button property.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 265
Chapter 7 ✦ The Power of Behaviors
6. Click the Shuffle Up button so that the Better Button behavior will execute before the Play Sound Member behavior. 7. Save the movie as engine8.dir, rewind it, and play it. Click the Enable Sound button; you’ll notice the change in ink and you’ll hear the Click sound, and then the AudioTrack sound will play when the mouse is released over the button. 8. Now stop the movie, rewind it, and play it. This time, click the Enable Sound button, and with mouse button still down, drag the mouse off the sprite. Note that the button is still highlighted, as shown in Figure 7-22.
Figure 7-22: The Enable Sound button remains highlighted after the cursor is dragged off the sprite before releasing the mouse button.
If users drag the cursor off the Enable Sound sprite before letting go of the mouse button, they can become confused, because the button is still highlighted and might appear to a user as if it should be doing something. To correct this problem, add a mouseLeave event that resets the ink of the Enable Sound sprite back to Copy.
Creating the mouseLeave Event and Action 1. Open the engine8.dir from the preceding exercise, if it’s not already open. 2. Open the Better Button behavior in the Behavior Inspector.
265
3486-6 ch07.f.qc
266
7/24/00
5:44 PM
Page 266
Part II ✦ Bringing It All Together
3. Click the Add Event pop-up button, and select the mouseLeave event. In the Actions pane, choose the Change Ink option and set the ink to Copy. 4. Save the movie as engine9.dir, and then rewind and play it. Click the Enable Sound button and drag the cursor off the button without letting go of the mouse button. The ink changes back to Copy, restoring the sprite to its original state. Note
At this point, it’s a good idea to replace the behavior applied to the Next Screen with your new Better Button behavior to ensure that both buttons behave in similar fashion.
5. Rewind the movie and stop it, making sure that the playback head is in frame 1. With the Behavior Inspector still open, select the Next Screen button sprite on the Stage or in the Score window. 6. In the Behavior List pane, select the Play Sound Member behavior and delete it. 7. Click the Behavior pop-up button, and select the Better Button behavior to attach it, as shown in Figure 7-23. Figure 7-23: The modified behavior list
8. Shuffle the Better Button behavior so that it is first in the list of behaviors attached to the Next button. 9. Save the movie again as engine9.dir, and then rewind and play it. Click the Next Screen button and note the change in ink, the click sound, and that the playback head advances to frame 5.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 267
Chapter 7 ✦ The Power of Behaviors
The Better Button behavior still lacks some behaviors commonly associated with a “well-behaved button.” In the next exercise, you add two more events/actions to the behavior that provide a visual cue to users when the mouse pointer moves over an active area on the Stage. You add an action to the new behavior that changes the cursor (mouse pointer) to a pointing finger when it moves over a button to which the behavior is attached. In Director, as in life, whatever is done must eventually be undone, so you also add a second behavior that restores the cursor to its normal state when the mouse pointer is not within the bounding box of the sprite (to which the behavior is attached).
Adding a Cursor Change to Your User-defined Behavior 1. With the engine9.dir movie and the Behavior Inspector still open from the preceding exercise, select the Better Button behavior in the Behavior List pane. 2. Click the Events pop-up button, and select the mouseWithin event. 3. Click the Action pop-up button, and then choose Cursor ➪ Change Cursor, as shown in Figure 7-24. Figure 7-24: Select the Cursor option from the Actions pop-up menu.
4. When the Specify Cursor dialog box appears, select the Finger option (see Figure 7-25). Click OK to close the dialog box. Figure 7-25: Choose the Finger cursor in the Specify Cursor dialog box.
267
3486-6 ch07.f.qc
268
7/24/00
5:44 PM
Page 268
Part II ✦ Bringing It All Together
5. To add a fourth event/action to the Better Button behavior, one that sets the cursor back to a pointer after the behavior is exited, be sure the Better Button behavior is still selected in the Behavior List pane of the Behavior Inspector. 6. Click the mouseLeave event that you added earlier. 7. Click the Action pop-up button and choose Cursor ➪ Restore Cursor. 8. Save the movie as engine10.dir. Rewind the movie, and then play it. Move the mouse pointer over the Sound and Next buttons (both have the Better Button behavior with the modified events attached). Note the change in the cursor when it is over the two buttons as compared to when it is not. Try out the Sound and Next buttons and note that all the previous actions assigned to this behavior still work. Director has almost any cursor type that you might need for your movies. Table 7-2 Shows each of the built-in cursors, as well as a description of the situation in which you should use them. Each cursor also has a number to which you can refer when creating Lingo scripts that call a particular cursor. Many programs use these cursors to indicate their tools and the cursors have come to mean specific kinds of operations. Note that switching to a specific cursor in your movie does not cause that cursor to perform that operation. You still have to develop the behaviors to do that. Note
The graphics of the cursors listed in Table 7-2 were taken from a Macintosh. Some cursors will look slightly different on Windows computers.
Table 7-2 Director’s Built-in Cursors Cursor
Name
Use
Cursor Number
Arrow
Standard Arrow pointer used to point on the screen. Usually the default cursor setting.
0
I-Beam
Used to indicate a text insertion point.
1
Crosshair
Used to indicate the starting point of a selection.
2
Crossbar
Denotes a selection that will be added to.
3
Watch
Usually used to indicate when the movie is paused in order to perform a read or write file activity.
4
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 269
Chapter 7 ✦ The Power of Behaviors
Cursor
Name
Use
Cursor Number
Blank
Hides the cursor. Used mainly for touch-screen applications.
200
Help
Used to point to an element on the screen that the user needs help using.
254
Finger
Indicates that some action can be taken if the user clicks on the element over which the cursor is positioned.
280
Hand
Enables the user to move the Canvas in much the same way that a piece of paper can be moved around a desktop.
260
Closed Hand
Used for when a user clicks on an element that can be dragged.
290
No Drop Hand
Indicates the element cannot be placed in the current position.
291
Copy Close Hand
Usually used with an Option (Alt) modifier key to drag a copy of an element.
292
Pencil
Used to draw a single pixel on the Stage. Often used with the Shift modifier key to constrain the selection horizontally, vertically, or to a 45-degree angle.
256
Eraser
Erases pixels that are under the cursor. Usually replaces them with the current background color. Often used with the Shift key to constrain the eraser horizontally, vertically, or to a 45-degree angle.
257
Select
Indicates that a rectangular bounding box can be created to make a selection. Often used with the Shift modifier key to constrain the selection to a square.
258
Bucket
Fills any connected pixels containing the same color that the icon is over.
259
Continued
269
3486-6 ch07.f.qc
270
7/24/00
5:44 PM
Page 270
Part II ✦ Bringing It All Together
Table 7-2 (continued) Cursor
Name
Use
Cursor Number
Lasso
Indicates that the user can create a free-form selection. Often used with the Shift modifier key to constrain the selection horizontally, vertically, or to a 45-degree angle.
272
Dropper
Used to indicate that the user can “suck” the color that is currently used under the cursor.
281
Air Brush
Used to indicate the user can spray pixels onto the screen, using a predetermined size and flow setting.
301
Zoom In
Indicates the screen will Zoom in by a predetermined increment from the chosen point.
302
Zoom Out
Indicates the screen will Zoom out by a predetermined increment from the chosen point.
303
Vertical Size
Usually used to indicate that a dialog box or window element can be sized vertically.
284
Horizontal Size
Usually used to indicate that a dialog box or window element can be sized horizontally.
285
Diagonal Size
Usually used to indicate that a dialog box or window element can be sized diagonally.
286
Creating Multi-State Buttons Until now, the button behaviors that you have created in this chapter have all used a single cast member. To enhance the look and feel of a button, you can create a multi-state button that consists of four different cast members that are assigned to the various states of the button. An effective multi-state button changes according to the event that is occurring in the life of the button. It should highlight when the mouse rolls over it, appear to be pressed while the mouse is being clicked on it, and then pop back up to its original state when the mouse button is released. In some situations, there should also be an inactive state that informs the user that
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 271
Chapter 7 ✦ The Power of Behaviors
the button is not available in the current context of your presentation. Adding a sound that plays when the button is clicked completes the user experience. Director has a couple of very useful behaviors that make it easier to create multistate buttons: the Push Button and the Multi-State Toggle behaviors. Although both behaviors enable you to assign a different cast member for each event, they each perform a different action. ✦ You use the Push Button behavior to create multi-state buttons that will either revert to their original state or that will appear to be inactive after they have been clicked. ✦ The Multi-State behavior acts like a toggle. You can vary the states of a single button between an on state and an off state. This behavior can also be applied to a group of buttons that will act like radio buttons. When one button in the group is set to its on state, the other buttons in the group are set to their off state.
Creating a push button In the next exercise, you apply the Push Button behavior to the Launch Rocket button and set the parameters of the behavior so that the button appears to light up when the mouse is rolled over it, and then appears to be pressed when it’s clicked on. You also add a click sound to the mouseDown and mouseUp states. You then apply the Rollover Cursor Change behavior so that the cursor changes to a finger when it is rolled over the sprite. This parameter works the same way as the change cursor event that you added to the Better Button behavior earlier in this chapter. On the CD-ROM
For the following exercise, you need to use the engine10.dir movie that you saved in the preceding exercise, or you can use the engine10.dir file found on the CD-ROM in the EXERCISE:CH07 (EXERCISE\CH07) folder.
Applying the Push Button Behavior 1. Open the engine10.dir movie, and then open the Library Palette. 2. Locate the Push Button behavior in the Controls category, and drag it onto the Launch Rocket sprite on the Stage. 3. The Parameters dialog box for this behavior appears. Note that the cast members were automatically assigned in the graphics options for this behavior. Like some of the other behaviors that you applied to other sprites, this behavior applies the cast members that follow the one to which the sprite is referring. Unless you have rearranged the cast members used for the Launch Rocket button, they should be in the correct order. The cast members that are applied to each event in the graphics options should be the ones shown in Figure 7-26.
271
3486-6 ch07.f.qc
272
7/24/00
5:44 PM
Page 272
Part II ✦ Bringing It All Together
Figure 7-26: A cast member is applied to each event in the graphics options parameters. Tip
In the Cast window, arrange the cast members in the order that they will appear in the behavior Parameters dialog box. This will save a lot of time if you are applying the behavior to several buttons. It’s also a good idea to add the name that is used for each state of the button (“roll,” “down,” “inert”) as the second word in the cast member’s name. This makes it much easier to find the correct cast member for each state of the button.
4. With the Parameters dialog box still open, select the Click sound cast member for both the Sound to play on mouseUp and the Sound to play on mouseDown options. Caution
If you choose to add a sound option to this behavior, make sure that you specify a sound cast member for both the mouseUp and mouseDown options; otherwise, this behavior will not function correctly.
5. Use the default settings for the last four options, because you want the button to be active on the Stage, and no sprites are covering the sprite to which this behavior is being applied. 6. Save the movie as engine11.dir. Rewind the movie and play it. Roll the mouse over the Launch Rocket button and click on it to see the different states that have been applied. 7. Stop the movie, and drag the Rollover Cursor Change behavior (choose Animation ➪ Interactive in the Library Palette) onto the Launch Button sprite on the Stage. 8. Make sure that the Finger cursor is selected in the Rollover Cursor dialog box, and then click OK to return to Director’s main window (see Figure 7-27).
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 273
Chapter 7 ✦ The Power of Behaviors
Figure 7-27: The Rollover Cursor change behavior enables you to change the cursor to a finger when it rolls over a sprite.
9. Save the movie again as engine11.dir, and then rewind the movie and play it. The cursor now changes to a finger when it is rolled over the Launch Rocket button. Later in this chapter, you add the navigation component to this button, which will advance the playback head to the frame in the Director movie where the sequence that launches the rocket occurs. In the next exercise, you rebuild the Enable Sound button, using the Multi-State button behavior, so that it acts as a toggle to turn the sound on or off.
Creating a multi-state toggle button You may have noticed that there is no way to turn off the AudioTrack sound other than by stopping the movie after it has started playing. You could create another button that turns off the sound, but this takes extra screen real estate, which is often at a premium in multimedia applications. A more effective way to turn the sound on and off is to have the Enable Sound button act as toggle — when the button is first clicked, the sound begins playing; if the button is clicked again, it stops the sound. The Enable Sound button should also have a visual cue informing the user that the button is either on or off.
273
3486-6 ch07.f.qc
274
7/24/00
5:44 PM
Page 274
Part II ✦ Bringing It All Together
The Multi-State Button behavior works in a way similar to the Push Button behavior in that you can specify different cast members for each event that occurs. The big difference is that you can specify cast members that respond to events for both the on and off states of the button. You can also assign a Lingo command that tells the button what operation to perform in the on and off states.
Adding the Multi-State Button Behavior 1. Open the Score window in the engine11.dir movie. Select the Sound button sprite in channel 6. 2. Open the Cast window, and expand the window so that the six cast members in slots 41 through 46 are visible. These are the cast members that you will use to build the new Enable Sound button (see Figure 7-28).
New enable sound button cast members Figure 7-28: The six cast members used for the Enable Sound button.
3. Select the cast member named soundOff normal in the Cast window, and choose Edit ➪ Exchange Cast Members or press Command+E (Ctrl+E) to switch the current cast member in sprite channel 6 with the soundOff normal cast member. Look at the Sprite Overlay for the Enable Button sprite on the Stage, and make sure that the soundOff normal cast member is listed in the cast member description. 4. Click on the Behavior button located on the Sprite Overlay for the soundOff normal sprite to open the Property Inspector. Select the behaviors that have been applied to the sprite, and then delete them. 5. Open the Library Palette and locate the Multi-State Button behavior in the Controls category, and then drag it onto the Enable Sound button sprite, either on the Stage or in the Score window.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 275
Chapter 7 ✦ The Power of Behaviors
6. When the Parameters dialog box appears, note that the cast members have been automatically applied to the Standard, Rollover, and mouseDown events for both the off state and the on state options. The members that have been applied should match the ones shown in Figure 7-29. Note
If the cast members have been moved from their original order in the Cast window, you may need to select the correct cast members from the pop-up menus located next to each event option. The second word of each cast member name is the same as the state to which the cast member should be applied.
Figure 7-29: Make sure that the cast members that are shown here are the ones that are applied to the off state and on state events for the behavior.
7. After making sure that the correct cast members are assigned to the Parameters listed in the dialog box (see Figure 7-29), click OK or press Enter (or Return, if you’re using a Macintosh) to set the options and return to Director’s main window. Note
For now, you leave the COMMAND SENT and ID string parameters as they are. A Lingo command can be added to both the COMMAND SENT when switched ON and the COMMAND SENT when switched OFF parameters, shown in Figure 7-29, that can cause the button to perform a specific operation when the button is toggled to an on or off state. The default setting for these two parameters sends a message to all of the other sprites in the frame, notifying them of the current state (on or off) of the sprite that can be sent to other sprites on the Stage or to a Lingo movie script. For another sprite to take advantage of this command, it needs a behavior applied to it that contains a Lingo handler that can intercept the message. The ID string for the group parameter enables you to assign a group name to a series of buttons that will use this same behavior. This is useful for creating radio buttons. Because you are applying this behavior to only a single button, there is no need to enter a group name in this parameter.
275
3486-6 ch07.f.qc
276
7/24/00
5:44 PM
Page 276
Part II ✦ Bringing It All Together
8. Click on the behavior button of Enable Sound sprite to open the Property Inspector. Add the Rollover Cursor Change behavior to the sprite from the Behaviors pop-up menu. 9. Save the movie as engine12.dir. Then rewind the movie and play it back. Roll the cursor over the Enable Sound button and note that it becomes highlighted. When you click on the button, it changes to a different color, indicating that it’s active. When you click the button again, it reverts to its original state. When the Multi-State button behavior is applied to a group of buttons, the button that is clicked on is set to the ON state and all the other buttons are set to their OFF state. This behavior can enable you to create custom multi-state radio buttons that are more visually appealing than Director’s built-in radio buttons. In the next exercise, you add a very basic Lingo command that plays the AudioTrack sound cast member when the Enable Sound button is in its ON state, and then turns the sound off when the button is in its OFF state.
Adding a Lingo command to a behavior Several of the behaviors in the Library Palette enable you to add simple Lingo commands that perform specific operations, such as triggering a behavior that’s applied to a different sprite in the frame. You can also send messages to custombuilt Lingo handlers that can perform a variety of operations. You learn a great deal about Lingo commands and creating handlers beginning in Chapter 11 of this book. You don’t have to be a “power programmer” to use Lingo commands that increase the capabilities of a behavior. You use the puppetSound Lingo command to play the AudioTrack sound cast member when the Enable Sound button is toggled to its ON state, and then turn the sound off when the button is toggled to its OFF state. Playing sounds with Lingo is discussed in detail in Chapter 17. For now, you only need to know how to specify the sound channel that the sound will play in, specify the sound cast member that will play, then turn it off again.
Adding the puppetSound Lingo Command 1. Make sure the engine12.dir movie that you saved in the preceding exercise is open in Director. In the Cast window, select the Audio Track member, and click on the Properties button to open the Property Inspector. Click on the Loop check box to enable the sound file to loop whenever it is played. 2. With the Property Inspector window still open, select the Enable Audio sprite on the Stage or Score. You may need to click on the Behavior tab to make the Behavior window active. Click on the Parameters button in the Property Inspector to display the Parameters dialog box for the behavior.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 277
Chapter 7 ✦ The Power of Behaviors
3. In the Command Sent When Switched On field, type puppetSound 2, “AudioTrack”. Make sure that you type this command exactly as shown in Figure 7-30, including the comma and quotation marks. This command tells Director to play the sound cast member called AudioTrack in sound channel 2 when the button is toggled to its ON state. 4. In the COMMAND SENT when switched OFF field, type puppetSound 2, 0 (see Figure 7-30). This command turns off the sound that’s playing in channel 2 when the button is toggled to its OFF state. The 0 in this Lingo statement is actually the equivalent of a FALSE command that acts as toggle to turn off the sound that is currently playing. You learn about true/false statements in Chapter 11. Note
True and false statements are Lingo’s way of turning a property on or off. They act like the on/off switch found on most electronic components. In fact, the symbol used for the on/off switch on most electronic equipment is a 1 or 0.
Lingo commands
Figure 7-30: Add the puppetSound Lingo command with statements that define the cast member and the sound channel, and turn off the sound.
5. Save the movie as engine13.dir. Rewind the movie and play it. Click on the Enable Sound button. The button toggles to its ON state and the AudioTrack sound cast member plays. Click the button again, and the sound stops playing and the button toggles to its OFF state. Adding simple Lingo commands is one way to greatly expand the capabilities of a behavior. As you learn more about Lingo in the second half of this book, you will be able to combine custom-built Lingo scripts with Director’s built-in behaviors to create very powerful multimedia applications.
277
3486-6 ch07.f.qc
278
7/24/00
5:44 PM
Page 278
Part II ✦ Bringing It All Together
Navigating with Markers Earlier we mentioned that multi-state buttons are far more useful if they actually do something when you click them. Fortunately, Director gives you an abundant collection of options as to what these buttons can do. One of the simplest and most useful roles for a multi-state button is providing the capability to jump to a different location in the Score. In earlier chapters, we briefly discussed markers, showing you how to use them to organize the Score. Markers are also indispensable for creating Director movies that will play back nonlinearly. After you begin learning scripting behaviors (in Chapter 11), you’ll discover that a simple instruction can direct the playback head to a frame number or a marker.
Adding markers to your movie Most of Director’s basic navigational commands and navigational behaviors make use of markers within a movie. As you learned earlier, markers are labels that you attach to specific frames. The steps to adding a marker are: 1. In the Score window, locate the Markers channel. As shown in Figure 7-31, the Markers Channel is immediately above the Effects channels.
Marker symbol Markers menu
Marker name
Markers channel
Figure 7-31: The Markers channel in the Score window
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 279
Chapter 7 ✦ The Power of Behaviors
2. Click in the Markers channel, above the frame where you want to add a marker. A symbol appears for the marker, as shown in Figure 7-31, along with a default marker name (New Marker). 3. You typically want to use a more specific marker name, such as Start. Just type it in, and the name you type replaces the default New Marker name. Tip
You can move a marker to a new location by dragging the marker symbol to a different frame.
To delete a marker, click on the triangular marker symbol and drag up or down off the Markers channel. You can choose from three different methods to display a list of all the markers in your movie: ✦ Choose Window ➪ Markers. In the Markers window, double-clicking on a marker name jumps the playback head to that marker. ✦ Click the Markers menu (see Figure 7-31) to display a pop-up menu of all markers. On the Markers menu, click the desired marker name to jump to that marker in your movie. ✦ Press Command+Shift+M (Ctrl+Shift+M) or choose Window ➪ Markers to display the Markers window shown in Figure 7-32.
Add new marker Previous marker Next marker
Marker frame indicator
Marker name Marker editing pane Figure 7-32: Use the Markers window to view all of the markers in your movie.
279
3486-6 ch07.f.qc
280
7/24/00
5:44 PM
Page 280
Part II ✦ Bringing It All Together
Now that you can add markers to your movies, you can use them to control the flow of your movie. You can combine button behaviors with frame and marker navigation to really enliven your interactive presentations. In the next series of exercises, you add markers to the engine13.dir movie, and then add a jump to marker behavior to the Launch Rocket button. On the CD-ROM
You use the engine13.dir movie that you saved in the previous exercise, or you can use the engine13.dir movie on the CD-ROM in the EXERCISE:CH07 (EXERCISE\ CH07) folder.
Adding Markers for Navigation 1. Open the engine13.dir movie in Director; then make sure the Score window is active. 2. Click in frame 1 of the Marker channel. Type Start. 3. Click anywhere in the Marker channel. Type Rollovers, and then drag the marker to frame 10. 4. Click anywhere in the marker channel and add a marker named Launch rocket. Then drag it to frame 15. The Score should look like Figure 7-33.
Figure 7-33: Click on a marker in the Marker window to move the movie’s playback head to the frame that contains the selected marker.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 281
Chapter 7 ✦ The Power of Behaviors
5. Open the Markers window by choosing Window ➪ Markers or by pressing Command+Shift+M (Ctrl+Shift+M). Make sure that frames that have sprites in them are visible in the Score window, as shown in Figure 7-33. Click on one of the markers in the Marker window and the playback head jumps to the frame that contains the marker you selected. 6. Save the movie as engine14.dir. Now you need to add a behavior to the Launch Rocket button that jumps to the marker called Launch Rocket. The behavior you will add is called the Jump to Marker Button and is in the Controls category in the Library Palette.
Using the Jump to Marker behavior The Jump to Marker Button is a very flexible behavior that makes it easy to add navigation elements to your buttons. Like most other behaviors, it can be added to other behaviors that have already been applied to the sprite. This behavior automatically creates a list of the markers that are contained in the movie so that you can quickly choose any marker from the pop-menu that’s presented in the Parameter dialog box. Tip
It’s a good idea to add markers to your movie as early as possible in the production process. You can always delete them, add new ones, or move them around later. Not only does this make the movie easier to navigate while you’re building it, but it takes advantage of the Jump to Marker Button behavior’s capability to create a list of the markers contained in the movie.
Adding the Jump to Marker Button Behavior 1. Make sure that the engine14.dir movie that you saved in the preceding exercise is open in Director. Open the Library Palette, and choose the Controls category from the Library List button. 2. Locate the Jump to Marker Button behavior, and drag it into the Launch Rocket Button on the Stage. 3. The Parameters dialog box appears, as shown in Figure 7-34. For the On mouseUp, jump to marker parameter, six items appear in the list. The first three, Previous, Loop, and Next, enable you to jump to the next marker, the previous marker, or loop on the current marker. The last three items (Start, Rollovers, and Launch rocket) are the markers that are contained in the movie. Select the Launch rocket item from this list.
281
3486-6 ch07.f.qc
282
7/24/00
5:44 PM
Page 282
Part II ✦ Bringing It All Together
Figure 7-34: The dialog box for the Jump to Marker Button behavior enables you to specify a marker, determine how the movie goes to the marker, and set a parameter that remembers the frame from which the movie jumped.
4. Use the default Go to option for the Jump Mode parameter. You can uncheck the Remember current marker for Back button, although it won’t affect the behavior in any way if you leave it checked. Click OK to return to Director’s main window. 5. Click the Parameters button to display the Parameters dialog box for the behavior (see Figure 7-34). Note
There are two options in the Jump Mode pop-up menu. They are Go to, which jumps to the specified marker, and Play and Return, which is used when you want to go to a marker to perform some activity and then jump back to the marker that you came from. If you choose the Play and Return option, you will probably want to make sure that the check box located next to the Remember current marker for Back button is checked. This enables the behavior to remember which markers have been visited.
6. Now you need to add a Hold on Current Frame behavior to frame 10 (under the Launch rocket marker) so that the movie loops on that frame. Open the Score window and click in frame 10 of the script channel. 7. Select the Hold on Current Frame behavior from the Behavior pop-up list in the Score window, as shown in Figure 7-35. Note
To perform the operation in Step 7, you may have to enable the Sprite toolbar in the Score window by Control+clicking (Alt+clicking) the Frame bar and choosing the Sprite Toolbar option.
8. Save the movie as engine15.dir. Rewind the movie and play it back. Click on the Launch Rocket button. It now jumps to the marker called Launch rocket. Caution
Try to avoid having two markers with the same name. The Jump to Marker Button behavior jumps to the first marker that contains the name specified. If you have two markers with the same name, you might have unexpected results.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 283
Chapter 7 ✦ The Power of Behaviors
Figure 7-35: Apply a behavior to the script channel or a sprite in the Score window from the Behaviors pop-up menu.
When you use the Jump to Marker Button behavior in combination with the Jump Back behavior, you can have a button jump to a specific marker and then jump to frame that it came from. Most of the other button navigation behaviors found in the controls category act similarly to the Jump to Marker Button behavior. You can use the other button behaviors in the Controls category to jump to a different movie, and then return to the previous movie. By now you have learned that Director’s built-in behaviors are very powerful, enabling you to add sophisticated interactivity to your movies. You can add multiple behaviors to a sprite that add layers of interactivity and good user interface design to the navigation elements in your movies. The movie to which you have been adding these behaviors is pretty simple; there aren’t too many buttons that need to have multiple behaviors applied to them. In a large project, applying many individual behaviors to each sprite can be a timeconsuming task. This is where Lingo comes to the rescue: You can create custom behaviors that combine the events and parameters of several different behaviors.
Where Did that Behavior Come From? As mentioned earlier, behaviors are scripts (and you’ll learn a great deal more about scripts in Chapter 11). Unlike many other development languages, Director’s scripts are actually kept as a resource. Specifically, the script is a cast member that contains the text of the script, as well as the internal code that stores the script when played at run-time. From the standpoint of the developer, a script is an autonomous entity, and behaviors are especially independent.
283
3486-6 ch07.f.qc
284
7/24/00
5:44 PM
Page 284
Part II ✦ Bringing It All Together
The independent nature of scripts and behaviors means that they can be collected in a cast and used in a variety of projects. An external cast can really include any kind of cast member (bitmap, text, script, video, and so on). The Library Palette is really just a collection of external casts that are stored in the Libs folder located in the Director Application folder. Although the Library Palette as shipped with Director contains only behaviors, you can add to the Library Palette any kind of cast member that can be contained in a Cast window. For instance, if you’re using a logo that appears in all of your movies, you can put the logo into an external cast and then move it into the Libs folder; it will appear in the Library Palette. A custom multi-state button behavior we call the MultiPurpose Button behavior was developed specifically for this book, although it might be useful to you in a variety of circumstances. Along with the MultiPurpose Button behavior, we also include several types of multi-state button cast members, and several sounds that were optimized for use with buttons. These elements are contained in a Cast Library called coolbuttons.cst. You can link them to your own movies and use them royalty-free, although you should read the comments (included as a text cast member in the Library) for more details. On the CD-ROM
The coolbuttons.cst Cast Library is on the CD-ROM in the EXERCISE:CH07 (EXERCISE/CH07) folder. There is also a folder in the Goodies section of the CD-ROM called COOLBUTTONS, which contains all of the original artwork created for the buttons found in the coolbuttons.cst Cast Library. They are supplied in both Photoshop 5.0 and Fireworks 2.0 formats, which you can modify using either of these two programs. Last but not least, is a folder called Buttons that you can drag into your Libs folder; it includes the buttons arranged by convenient categories in your Library Palette.
Cool button factories The artwork that was created for all of the buttons in the coolbuttons.cst Cast Library started life as Photoshop 5.0 artwork. Both Photoshop and Fireworks have the capability to create graphic documents that contain many layers. You can take advantage of this capability by creating what this author calls factories, which have layers containing all of the states of a button in a single document. There are several advantages to this technique. The first is that you need to manage fewer documents for the original artwork that you create for your movies. A second advantage is that you can view how the different states of the button look by turning on and off each layer that contains the different button state graphic. After you are satisfied with each state of your button, you can create the individual cast members by turning on the appropriate layers and performing a Save As operation in Photoshop or Exporting in Fireworks. Spend some time looking at the button factories to get a better idea of the power of this technique. In fact, after you become familiar with the factories, feel free to modify them (by adding text labels, for example) for your own movies.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 285
Chapter 7 ✦ The Power of Behaviors
Cast libraries In traditional programming languages such as C and C++, creating an application is sometimes a challenge. Many developers manage the overall project by breaking it up into distinct tasks — that is, by separating the application into modules. Director originally didn’t support this method — everything had to be contained in a single movie, and that typically meant a lot of duplication if one movie needed to have the same resources as another. Cast Libraries were Director 5.0’s answer to the demands of developers for a more efficient container of resources. A Cast Library is a separate and discrete entity. It has its own cast members and can be used to store any cast members that the normal internal cast can use. There’s no real limit to the number of Cast Libraries a movie can open (although certainly system limitations will limit the number). Cast Libraries come with some drawbacks. Because they are linked as an external source, you need to be careful not to move either the director movie that is using the library or the Cast Library itself to another location. You also need to include any external Cast Libraries that are used in a movie when outputting a Director movie as a Projector, Shockwave movie, or Java applet. It also possible to accidentally modify an element in a linked cast and then save over the original Cast Library, thus losing the original element forever. If you have elements such as scripts, behaviors, or graphics that you want to preserve in their original state, you might want to put the casts into the Libs folder so that they will appear in Library Palette. As you know by now, when you modify a behavior (or any other element that can be contained in the Library Palette), you are actually modifying a copy of the element that has been placed into an internal Cast window.
Adding a custom-built behavior to your movie We have created an external Cast Library called coolbuttons.cst that contains a very useful, all-purpose button behavior that combines the button states, cursor change, and navigation parameters into a single behavior. There are also several multi-state button graphics that you can use royalty-free in your Director movies. You will link the coolbuttons.cst Cast Library to your movie, and then replace the three behaviors that have been applied to the Launch Rocket button with the custom-built behavior called the MultiPurpose Button behavior. On the CD-ROM
The coolbuttons.cst is on the CD-ROM that came with the book in the EXERCISE: CH07 (EXERCISE\CH07) folder.
285
3486-6 ch07.f.qc
286
7/24/00
5:44 PM
Page 286
Part II ✦ Bringing It All Together
Linking Cast Libraries to Movies 1. Copy the coolbuttons.cst external Cast Library to a personal folder (where you saved your other Director movies) on your local hard drive. 2. Open the engine15.dir movie. 3. Choose Modify ➪ Movie ➪ Casts, or press Command+Shift+C (Ctrl+Shift+C) to display the Movie Casts dialog box (see Figure 7-36). Figure 7-36: The Movie Casts dialog box enables you to link Cast Libraries to your current movie.
4. Click the Link button. This displays an Open (file) dialog box, where you can select a Cast Library (any file with the .cst or .cxt extension). Locate the coolbuttons.cst external cast and double-click on it to link it to the current movie. After the cast is linked, you can access it through the Cast window. Note
If you have the CD-ROM in your CD-ROM drive, you can link to coolbuttons.cst on the CD-ROM located in the EXERCISE:CH07 (EXERCISE\CH07) folder, or if you’ve copied it to your local drive, you can locate it there.
5. Click OK to close the dialog box. 6. If the Cast window is not visible, open it by pressing Command+3 (Ctrl+3). 7. Click the Choose Cast button (the button in the upper-left corner of the Cast window), and a list of the active Cast Libraries for the current movie appears (see Figure 7-37). 8. Select CoolButtons to make the library available to the current Director movie. 9. Click the Cast Library button again and set the cast back to Internal, which is the default cast for a movie. This setting ensures that any new cast members you add will be added to the Internal cast rather than to the imported (CoolButtons) cast. 10. Save the movie as engine16.dir. You can also incorporate the coolbuttons Cast Library into the Library Palette. Just drag the coolbuttons.cst into the LIB folder found in the application folder for Director 8. This will enable you to access the MultiPurpose Button behavior and all of the button bitmap and sound cast members from the Library Palette. The
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 287
Chapter 7 ✦ The Power of Behaviors
advantage to this approach is that the behavior, button bitmap, and sound cast members will automatically be included in your movies.
Figure 7-37: Clicking the Cast Library button brings up a list of all the current Cast Libraries.
Still another way of accessing the cast members of a library is to place the Cast Library in the Xtras folder located in the application folder containing your copy of Director. This technique makes the cast available from the Xtras menu. For example, if you drag the coolbuttons.cst into the Xtras folder, you’ll see a CoolButtons entry in the Xtras menu. Note, however, that the cast is not actually linked to the file. You have to physically drag one or more cast members from the cast into your movie’s internal cast to make them work. If you use this method, Director prompts you whether to link the external cast or just transfer the selected cast members to the internal cast.
A cast library case study Two of the authors of this book were building a Director-based engine for an interactive news journal that would be updated on a daily basis. This was a huge undertaking that required several programmers and multimedia authors working simultaneously to meet the ever tightening deadline for the release of the product. The Director templates and interface elements being built for the application were being produced at the same time that the code was being written, so we had to have a way to update all of the different components. Cast Libraries came to our rescue. We divided up the components into several shared Cast Libraries that were stored in a specific location on the network, and then linked to the Director the movies that the multimedia authors were building. Because the source code was stored as several components in a linked Cast Library, new functionality and bug fixes were globally updated in all of the individual Director movies. It was an amazing sight to see a bug magically fixed on four different Director movies running on four different computers at the same time. We also used this approach to create custom authoring tools that were developed for the application.
287
3486-6 ch07.f.qc
288
7/24/00
5:44 PM
Page 288
Part II ✦ Bringing It All Together
Now that you have the Coolbuttons Cast Library attached to your movie, it’s time to replace the behaviors attached to the Launch Rocket button with the MultiPurpose Button behavior that was custom-built using Lingo. The advantage to the MultiPurpose Button behavior is that it replaces the Push Button, Rollover Cursor Change, and Jump to Marker Button behaviors with a single behavior that enables you to set all of the parameters used for the three behaviors that were previously applied to the sprite.
Adding a Custom Built Behavior 1. Open the engine16.dir movie in Director. Click on the Launch Rocket sprite on the Stage, and then click on the Behavior button in the Sprite Overlay to open the Property Inspector. 2. Delete the three behaviors that are applied to the sprite. 3. Add the MultiPurpose Button behavior from the Behavior List button. 4. When the Parameters dialog box appears, make sure the cast members selected for Up State, Down State, Roll State, and Inert State are the launchButton cast members shown in Figure 7-38. Tip
If you add the name of the state to which the cast member will be applied, it makes it much easier to locate them when it comes time to apply the cast member’s parameters to a multi-state button.
Figure 7-38: All of the cast members, except for the Up state, have the name of the state they are designed for as the second word in the cast member name.
5. Click on the Inert after use? check box so that the button will be inactive after it has been clicked. 6. Select the Click sound cast member for the sound parameter. 7. Click on the Action pop-up menus, and choose the go “Launch rocket” option. This behavior creates a list of the markers that are contained in the movie and adds them as options for the Action parameter.
3486-6 ch07.f.qc
7/24/00
5:44 PM
Page 289
Chapter 7 ✦ The Power of Behaviors
8. Make sure that the Finger option is set for the Use which cursor? parameter. If you click on the pop-up menu for this parameter, you will see a list of all the built-in cursors for Director. 9. Save the movie as engine17.dir. Rewind the movie and play it, and then click on the Launch Rocket button. The Launch Rocket button acts the same way as it did when it had the three different behaviors applied to it. Note
You can activate the button after it has been set to an inert (inactive) state by double-clicking on it. You can also activate the button by sending a custom message called the #enable message to the sprite with Lingo.
The MultiPurpose Button behavior was completely written in Director using Lingo. If you had to add the three original behaviors that were applied to the Launch Rocket button to 50 or 60 other buttons, it would be very time-consuming and would probably require a lot of debugging. This is a situation in which a custom-built behavior such as the MultiPurpose Button can save you a lot of creation time as well as prevent a swollen mouse finger. There are many situations where a well-designed custom behavior will save a tremendous amount of time building a Director movie. Suppose that you are building an application in which you want to test the user’s comprehension of the subject matter at different points in the Director movie. To accomplish this goal, you want to build a quiz in which the user drags pictures next to the words that define them. You could design a behavior in Lingo where you assign the matching graphic and text cast members, and add a parameter to apply sound cast members for positive and negative feedback sounds. There could also be a field where you could type in a custom message that will appear as a custom alert message. Combining all of these events into one single behavior would enable you to spend most of your time creating high-quality visuals for the quizzes instead of linking all of the pieces together with a series of individual Lingo scripts that would have to be modified for every quiz.
Sending a Message from One Behavior to Another Many of Director’s built-in behaviors can send a message to other sprites, behaviors, frame scripts, and cast member scripts. These messages are usually sent to a Lingo handler — a set of instructions that tells Director what to do when an event occurs. A message can be sent to a specific sprite, to all the sprites in the frame, to a specific behavior, to a frame script, or to a movie script. You learn how to send messages with Lingo starting in Chapter 11. In this chapter, we look at sending simple messages from one behavior to another.
289
3486-6 ch07.f.qc
290
7/24/00
5:44 PM
Page 290
Part II ✦ Bringing It All Together
You can find out whether a behavior can send or receive a message by looking at the behavior’s description in the Behavior Inspector. Director’s built-in behaviors will describe the message that can be sent to or from the behavior. Figure 7-39 shows the message that can be used to activate the SlideIn/Out behavior. There is a parameter setting for this behavior that can activate the behavior when the playback head enters the frame, by clicking on the sprite to which the behavior is attached, or by sending the mSlideActivate message from another behavior or Lingo script. Figure 7-39: The descriptions for Director’s built-in behaviors will list any specific messages that can be sent to and from the behavior.
Message to activate the behavior
Note
You have to drag a behavior from the Library Palette into the Cast window before you can view the behavior’s description in the Behavior Inspector.
The mSlideActivate message shown in Figure 7-39 activates the Slide In/Out behavior. When the behavior receives the message, it causes the rest of the events in the behavior to execute.
Sending a message from a behavior One of Director’s built-in behaviors that can be activated by a message sent from another behavior is the Countdown Timer behavior. This behavior is located in the text category of the Library Palette. The Countdown Timer behavior can be applied to a text or field cast member to create a digital clock that counts from a predetermined time down to zero. A message or command can be sent from this behavior to activate a behavior applied to another sprite when the timer reaches zero. In the next two exercises, you apply the Countdown Timer behavior to a text cast member that will execute when the movie enters the Launch Rocket frame. When
3486-6 ch07.f.qc
7/24/00
5:45 PM
Page 291
Chapter 7 ✦ The Power of Behaviors
the timer sprite reaches zero, it sends a message that initiates the Slide In/Out behavior that has been applied to the Rocket sprite, causing the rocket sprite to fly off the top of the Stage. On the CD-ROM
You need the engine17.dir Director movie for the next exercise. You can use the one that you saved in the preceding exercise or use the engine17.dir file on the CD-ROM in the EXERCISE:CH07 (EXERCISE\CH07) folder.
Creating a Countdown Timer 1. Open the engine17.dir movie in Director, and make sure the Cast window is active. 2. Open the Library Palette (choose Window ➪ Library Palette). Click on the Library List button, and select the Text category. Locate the Countdown Timer behavior and drag it into the Cast window. 3. Choose Animation ➪ Automatic in the Library Palette, locate the Slide In/Out behavior, and drag it into the Cast window. You can close the Library Palette to get it out of the way. Note
You will be sending a message from the Countdown Timer behavior to the Slide In/Out behavior, so you need to find out what message the Slide In/Out behavior requires to initialize it.
4. Locate the Slide In/Out behavior in the Cast window and double-click on the cast member to open it in the Behavior Inspector. In the Description pane is a sentence that describes how the behavior can be activated (see Figure 7-40). One of the options listed informs you that this behavior can be sent a message called mSlideActiviate. Double-click on the mSlideActiviate text in the Description pane to select it, and copy it to the Clipboard. Figure 7-40: The sentence describing the options that activate this behavior is highlighted.
291
3486-6 ch07.f.qc
292
7/24/00
5:45 PM
Page 292
Part II ✦ Bringing It All Together
Note
If the behavior opens in the script window, you should adjust the preferences so that behaviors open in the Behavior Inspector. Choose File ➪ Preferences ➪ Editors and then select the Behavior Inspector as the editor for behaviors.
5. Close the Behavior Inspector. In the Score window, advance the playback head to frame 10, and then on the Stage, select the text sprite called Countdown Timer. Drag the Countdown Timer behavior onto the sprite. The Parameters dialog box for the Countdown Timer behavior appears, as shown in Figure 7-41.
Figure 7-41: The parameters for the Countdown Timer behavior should be set as they are shown in this figure.
6. Note that this behavior can also be initialized by a message that is sent to it; however, in this situation, you will want the behavior to be activated when the playback head enters the frame where the sprite is located. Use the default setting for the Initializing event parameter. 7. Choose Hundredths from the Smallest time unit parameter pop-up menu. This choice displays the timer in hundredths of a second. 8. Move down to the Seconds to count down slider, and click on the advance arrow until the slider displays 10 seconds. You can also drag the slider to 10 seconds if you prefer. 9. Double-click the text in the field located next to the Message to send after countdown parameter to select it. Paste the mSlideActivate message, which you copied to the Clipboard earlier in this exercise, into the field. You can also type the mSlideActivate message into this field, but be careful that you type the message correctly.
3486-6 ch07.f.qc
7/24/00
5:45 PM
Page 293
Chapter 7 ✦ The Power of Behaviors
Tip
Whenever possible, it is better to select the actual message, copy it to the Clipboard, and paste the message into the field where you want the message to appear. This avoids the possibility of introducing a typing error that could cause the behavior to work incorrectly.
10. Use the default setting of all sprites for the Where to send message parameter, because you will be sending the message to another sprite. There is no need to check the Broadcast countdown time parameter in this situation. Note
The Broadcast countdown time parameter constantly sends the current time to all of the other sprites on the Stage. You are concerned only about sending a message when the timer reaches zero, so enabling this parameter will have no effect.
11. Click OK to set the parameters and return to Director’s main window. Save the movie as engine18.dir. Rewind the movie and play it. Click on the Launch Rocket button, and you will see the countdown sprite ticking off the seconds until it reaches zero. Even though the mSlideActivate message is being sent from the Countdown Timer behavior, nothing happens when the timer reaches zero seconds. The Slide In/Out behavior that this message will activate needs to be added to the rocket sprite before anything can happen. In the next exercise, you add the Slide In/Out behavior to the rocket sprite and set the parameter to activate the behavior when the behavior receives the mSlideActivate message.
Receiving a message from another behavior As you know, you can activate several of Director’s built-in behaviors by means of a custom message sent from a behavior applied to a sprite or to a Lingo script contained in the movie. Having a behavior be activated when a message is sent to it enables you to create very dynamic, event-driven animations that can happen in a single frame of your movie. This can save a lot of space in the Score window as well as make your movies more compact. You can create very complex Lingo movie scripts that can globally intercept messages that have been sent from behaviors, and then send the messages to appropriate sprites on the Stage to activate the behaviors that are applied to them. Combining Director’s built-in behaviors with custom Lingo scripts can save quite a bit of development time, because you would only create Lingo scripts that would interpret and distribute the messages. You can learn more about sending and receiving messages to and from sprites beginning in Chapter 11; this concept is used throughout the Lingo section of the book.
293
3486-6 ch07.f.qc
294
7/24/00
5:45 PM
Page 294
Part II ✦ Bringing It All Together
You can still take advantage of the messaging capabilities of a behavior without having any Lingo programming knowledge to execute them. There are many situations in which simply selecting the Activate with Message parameter for a behavior will accomplish the task that you need the sprite to perform. In the next exercise, you apply Director’s Slide In/Out behavior to the rocket sprite and set a parameter that initializes the behavior when the it receives the mSlideActivate message that is sent from the Countdown Timer behavior. When the behavior is activated, the rocket sprite automatically flies off the top of the frame.
Using a Message to Activate a Behavior 1. Open the engine18.dir movie that you saved in the preceding exercise in Director. In the Score window, advance the playback head to frame 10. 2. On the Stage, select the rocket sprite, and then drag the Slide In/Out behavior from the Cast window onto the sprite. The Parameters dialog box for the behavior appears (see Figure 7-42). The parameters for this behavior can be set to determine whether the sprite will slide in or out of the frame, and the direction that the sprite will slide. You can set a point to which you want the sprite to slide, determine how the behavior will be activated, select how many times the behavior will execute, and define the time period over which the sprite will slide.
Figure 7-42: The Slide In/Out behavior contains several parameters that can be set to control how the animation occurs.
3. Select the Out option from the Slide In or Out pop-up menu. This choice causes the sprite to move off the frame when the behavior is activated. 4. Select the Top option from the Automatic Slide Direction parameter’s pop-up menu so that the Sprite slides off the top of the frame. Note
You use the Horizontal and Vertical point values if you select the Point option for the Automatic Slide Direction parameter. You can set the Horizontal and Vertical points on the Stage to (or from) which you want the sprite to slide, depending on the Slide In or Out option that you selected.
3486-6 ch07.f.qc
7/24/00
5:45 PM
Page 295
Chapter 7 ✦ The Power of Behaviors
5. Choose the Message option from the pop-up menu next to the Start automatically, when clicked, or by message parameter. This behavior contains a Lingo handler that intercepts the mSlideActivate message sent from the Countdown Timer behavior and activates the rest of the behavior. 6. Use the default setting ( 0 ) for the Slide cycles parameter, because you want the sprite to animate only one time. 7. You can use the slider controls next to the Time period for slide parameter to set the amount of time that the animation will use to slide the sprite to its end position. 8. Click OK when you have selected the parameters that you want for the behavior to return to Director’s main window. 9. Save the movie as engine19.dir. Rewind and play it. Click on the Launch Rocket button. The Countdown Timer activates and begins counting down to zero. When the timer reaches zero, it sends the mSlideActivate message to the Slide In/Out behavior. This activates the behavior and causes the rocket to appear to fly off the top of the frame. As you can now see, Director’s built-in behaviors provide a very powerful way to add interactivity to your Director movies using very little or no Lingo. Although you’ve worked with only a few of Director’s built-in behaviors (so many behaviors are shipped with the application that a whole book could be written on this subject alone), you should have a good idea of how to use behaviors in your movies. It’s worth taking some time on your own to familiarize yourself with the behaviors found in the Library Palette. It’s an investment that could save you untold hours of movie-creation time. We’ve provided more information about Director’s built-in behaviors in Appendix B. This appendix has descriptions of all the behaviors found in the Library Palette.
Summary This chapter taught you how to add interactivity to your Director movies using behaviors that enable you to create sophisticated buttons to navigate your movies, as well as to create animated special effects. Before moving on to the next chapter to learn about the various ways the movies that you created in Director can be output, review some of the important features about behaviors that were discussed in this chapter: ✦ Director ships with a variety of useful behaviors that are contained in the Library Palette. ✦ Behaviors are a collection of event handlers, and each handler contains one or more actions. The Behavior Inspector translates these behaviors, events, and actions into scripts, handlers, and statements.
295
3486-6 ch07.f.qc
296
7/24/00
5:45 PM
Page 296
Part II ✦ Bringing It All Together
✦ Behaviors contain parameters that you can set to control the way a behavior will work, as well as how a behavior is activated. ✦ Messages can be sent to some behaviors that then can activate them. Several behaviors are also capable of sending messages that can be interpreted by Lingo scripts and other behaviors. In Chapter 8, you learn how to fine-tune and then output your movies so that they can be played back without having to use Director.
✦
✦
✦
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 297
8
C H A P T E R
Fine-Tuning and Outputting Your Movies
F
ine-tuning your Director project can make the difference between a successful project and one that lacks that certain sophistication that distinguishes your movie from others. Adjusting the tempo, adding transitions between scenes, and animating palettes to add polish to your movie are all refinements that help make your Director projects successful. After you’ve added the finishing touches to your movie, you can create a projector, a Shockwave movie, or a Java applet of your Director project. The success of your projector, Shockwave movie, or Java applet starts long before you get to that point, however. A successful project depends upon the planning stages that occur before you even start Director. In this chapter, you learn to apply finishing touches and to prepare your movies for distribution.
Changing the Tempo The human eye can see minute differences in objects and motion. This capability is tempered, however, by perception. What we see is not the same as what we perceive. We mentally filter images to meet our perception of reality, based upon what we’ve learned to expect. The mind fills in gaps between events and skews the perception, to better understand the images it receives. For you to create animation, it’s not necessary to become an expert on perception. It is helpful, though, if you understand that you can make perception work for you when you are creating an animation project.
✦
✦
✦
✦
In This Chapter Changing the tempo Working with transitions Color palettes Building projectors Shocking your movies Using the Publish settings Exporting movies as Java applets
✦
✦
✦
✦
3486-6 ch08.f.qc
298
7/24/00
5:45 PM
Page 298
Part II ✦ Bringing It All Together
The tempo of a Director movie has a great deal to do with perception of motion. Tempo is the frame rate at which an animation sequence moves. The major television technical standards used throughout the world are NTSC (National Television Standards Committee), PAL (Phase Alternation Line), and SECAM (Sequential Couleur Avec Mémoire). NTSC video or broadcast-quality video displays at a rate of 30 fps (frames per second). PAL and SECAM display video at 25 fps. Although it might seem ideal for your Director movies to display at these frame rates, or even at the maximum speed of 999 fps, it’s unrealistic and unnecessary for them to do so. Because of the way we perceive motion, if a Director movie is well designed, it’s doubtful that most people will notice the difference between a movie at 15 fps and one at 60 fps. It takes a computer with substantial resources to render images at 999 fps, or even at 30 fps. High-end computers with fast processors, large amounts of RAM, and fast video systems might be able to render images at this rate. These machines are generally found on the desks of computer professionals, however, and they don’t represent the typical user. The average home computer can reasonably expect to render images at a rate between 10 and 15 fps. Director provides three ways to adjust the frame rate of a movie: through the Control Panel, in the Score window, and using Lingo commands. Regardless of which method you use to adjust the frame rate of your movies, it’s important to understand that the frame rate is a theoretical maximum. For example, if you were to set the frame rate of a movie to 60 fps, it wouldn’t mean your movie would play at that speed. The actual speed of the movie would automatically drop to whatever frame rate the computer is capable of displaying.
Operating the Control Panel The Control Panel operates much like a VCR. Using the Control Panel’s controls, you can view and control the playback of your movie. Choose Window ➪ Control Panel, or press Command+2 (Ctrl+2), to display the Control Panel (see Figure 8-1). Figure 8-1: The Control Panel enables you to view and control the playback of your movie.
Each of the buttons and windows on the Control Panel has a specific function (see Table 8-1) to help you quickly adjust a variety of playback options. Changes you make using the Control Panel are global changes. Any settings you make here affect the entire movie, and can only be overwritten by settings made in the Score window or by using Lingo.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 299
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Table 8-1 Control Panel Functions Control
Description Steps back one frame. Steps forward one frame. Frame counter: Displays the frame in the Score on which the playback head is sitting or through which it is passing currently. Enables you to choose whether to display frame rate as fps or as seconds per frame. Click the corner arrow to make your selection. Frame rate control: Enables you to adjust the frame rate of your movie. Click the up and down arrows to select a frame rate, or type a new frame rate into the box. In this position, the Loop Playback button is toggled to play a movie to the end and then stop. In this position, the Loop Playback button is toggled to play a movie to the end, loop back to the beginning, and play it again. Volume control: Click the arrow in the lower right corner, and choose a volume level. Rewinds your movie to frame 1. Pauses or stops your movie. Plays your movie or the selected range of frames. Displays the current frame rate. This is an instantaneous reading, not an average speed, and may vary widely depending on the content of the Stage at any moment. In this position, the Selected Frames Only button is toggled to play only the selected frames of a movie. In this position, the Selected Frames Only button is toggled to play all frames of a movie.
299
3486-6 ch08.f.qc
300
7/24/00
5:45 PM
Page 300
Part II ✦ Bringing It All Together
Tip
Checking for consistency: A valuable item on the Control Panel is the display of the current frame rate of your movie during playback. While you’re testing a movie, it’s a good idea to keep the Control Panel open and compare the current frame rate with the animation on the screen. Ideally, the frame rate of your movie should be consistent. The animation should move smoothly and at a consistent pace. Watch for fluctuations in the frame rate: Small ones are normal, but a dramatic change could indicate that you need to make an adjustment.
Specifying tempo settings in the Score window Tempo is a design consideration whenever you create a Director movie. You may be aiming for anything from the relaxed pace of a slideshow presentation, to the “warp” speed of a starship racing across the galaxy. By specifying tempo settings in the Score window, you can ✦ Determine the maximum speed for your movie. ✦ Pause your movie for a specified period of time. ✦ Tell Director to wait for user interaction before continuing the movie. ✦ Wait for a cue point in a digital video or sound file. (Chapters 5 and 6 discuss cue points.) The tempo in a Director movie can be changed as often as necessary. It’s a good idea to set the base tempo at the start of your movie, however. This helps you to control the frame rate and reduce fluctuations in the playback of your movie. If you don’t specify a tempo at the beginning, Director plays the movie at the maximum default frame rate of 30 fps. This can cause some significant fluctuations in the actual frame rate, depending on the available resources of the computer used to play the movie and the complexity of the movie. Although you can’t completely eliminate fluctuations in the frame rate, you can minimize their visual impact in your movie by slowing the frame rate of more complex animation sequences.
Compensating for a slow playback When you create an animation sequence in Director, you use a set of keyframes to describe the major movements of the object being animated. Suppose that you are animating the movement of the minute hand on a clock. If you create images that display the minute hand at the 12-, 3-, 6-, and 9-o’clock positions, you can use those images as keyframes for the animation sequence. Tweening between the keyframes simulates the movement of the minute hand. When the tempo of your movie slows, animation sequences can become jerky. It might not be appropriate or possible to increase the frame rate, but you can compensate for jerky animation either by adding more tween steps or by increasing the number of keyframes. In the clock example, increasing the number of tween steps between the keyframes of the animation smoothes the motion of the minute hand. You can also obtain a smoother motion by creating keyframes every 10 minutes instead of every 15 minutes.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 301
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Specifying a frame rate Controlling tempo is always important — and sometimes critical — to your movie. A polka would sound very strange if it were played to a disco beat. Similarly, if you are trying to build a suspenseful moment in your movie, you might want to slow the tempo of your movie over a selected range of frames. As mentioned earlier, to help ensure a consistent tempo throughout your movie you can select a median frame rate at the beginning of your movie. In this first exercise, you do just that. Note
Whenever you specify a tempo setting, that tempo setting remains in effect until you change it.
On the CD-ROM
You can use the marspics.dir Director movie on the companion CD-ROM for the next exercise. The marspics.dir movie is located in the EXERCISE:CH08 (EXERCISE\ CH08) folder.
Setting the Base Tempo 1. Open the marspics.dir or any other movie in Director. 2. Choose Window ➪ Score to display the Score window. 3. Click the Hide/Show Effects Channels button to expand the Score window to display the Effects channels, if necessary. 4. Double-click the Tempo channel in the first frame of your movie (the Tempo channel is the one with a small clock icon). This displays the Frame Properties: Tempo dialog box (see Figure 8-2). You can also choose Modify ➪ Frame ➪ Tempo to get this dialog box.
Figure 8-2: Use the Frame Properties: Tempo dialog box to specify the frame rate for your movie.
5. Select the Tempo radio button, and click the left and right arrows to slow down or speed up the frame rate for your movie. A frame rate of 15 fps is a good median rate.
301
3486-6 ch08.f.qc
302
7/24/00
5:45 PM
Page 302
Part II ✦ Bringing It All Together
6. Click OK to complete the operation and return to Director’s main window. The frame rate stays at 15 fps (or whatever setting you selected) until you change it in a later frame of the Score or through a Lingo command. You can create a dramatic moment in your movie by slowing the frame rate to 2 to 4 fps in the frames where you want the slowdown. Suppose that you want to show a heavy weight being hoisted to the top of a building and then dropping to the ground. By slowing the frame rate during the frames in which the weight is rising to the top of the building, you reinforce the illusion of weight. The drama of the event is further enhanced when the weight falls back to the ground at the normal (or faster) frame rate. Tip
Tempo settings don’t affect the duration of any transitions that you’ve set in the transition channel, and they don’t control the speed at which a sound plays. They control the maximum speed at which the playback head moves from frame to frame.
Pausing a movie Pausing a movie for a specified period is a useful technique if you are creating a presentation, and you want to stop the movie briefly while the user views the contents of the frame. A typical use for a tempo pause is a noninteractive kiosk presentation of a product line. During the three- to five-second pause while each product appears on the screen, the viewer sees an entire product line in a slideshow presentation.
Specifying a Pause in Your Movie 1. Open the marspics.dir or any other movie in Director. 2. In the Score window, double-click the Tempo channel in the frame where you want to insert a pause. 3. In the Frame Properties: Tempo dialog box, select the Wait radio button, and click the left or right arrows to specify the number of seconds you want your movie to pause (see Figure 8-3).
Figure 8-3: The Wait option pauses the move for a specified amount of time.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 303
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
4. Click OK to complete the operation and return to Director’s main window. 5. Rewind your movie and click the Play button to test the pause time. Tip
If you want to duplicate your pause setting in another frame, you can quickly copy the tempo cell in the Score window by pressing Command+C (Ctrl+C). Then click the other frame and paste the tempo by pressing Command+V (Ctrl+V).
You might need to test and change the pause time to get the right pause length. What you’re aiming for in this case is to give the user long enough to view the contents of the frame, without making the wait too long before the movie continues. Generally, a pause of three seconds is more than adequate for viewing a graphic. If you are creating a pause for a frame that contains text, you need to specify a longer time. Tip
It’s a good idea to have the frame reviewed by someone who’s unfamiliar with the text. You probably know the text well and, as a result, may be inclined to set an insufficient pause time. Getting another point of view reduces the risk of this happening, and it allows for the variation in the speed at which people read.
Waiting for user intervention Another tempo option is when you want to enable the user to control the pace. You can arrange for user control of a range of frames by using a wait setting in the Frame Properties: Tempo dialog box. A wait setting pauses your movie until the user presses a key or clicks the mouse button. Wait settings are especially useful if you need to display multiple frames with text and want the user to control the pace.
Specifying a Wait Setting 1. Open the marspics.dir or any other movie in Director. 2. Double-click the Tempo channel in the frame where you want to specify a wait setting. 3. In the Frame Properties: Tempo dialog box, select Wait for Mouse Click or Key Press (see Figure 8-4).
Figure 8-4: Selecting the Wait for Mouse Click or Key Press option pauses the movie until the mouse is clicked or a key is pressed.
303
3486-6 ch08.f.qc
304
7/24/00
5:45 PM
Page 304
Part II ✦ Bringing It All Together
4. Click OK to complete the operation and return to Director’s main window. 5. Rewind your movie and click the Play button to test your wait setting. The Wait for Mouse Click or Key Press setting works well for a Director movie that is used as a speaker support in a presentation. The Wait for Mouse Click or Key Press option enables the presenter to discreetly cue the next image by pressing a key or using a special “Air Mouse” (a mouse that doesn’t need to be physically wired to the computer). One drawback to specifying a wait setting in the Score window is that the user can click anywhere on the screen or press any key to continue the movie. If you want the user to click a special button or a specific key, you need to use a behavior or create a Lingo script. CrossReference
For more information about using Lingo scripting to specify a wait setting, see Chapters 7 and 11.
Working with Transitions Very few things can startle the viewer of a movie more than an abrupt change from one scene to the next. You can eliminate this problem by creating a transition between the frames. A transition is a technique by which some sort of passage connects two sequential frames in a movie. Figure 8-5 illustrates a transition; it shows two intermediate images that make up part of the passage between the starting and ending images. The transition in the figure uses a Dissolve effect, to create a blend of the two images as the intermediary Stages in the passage. Like many other elements in your Director movies, transitions are represented both in the Score window and as cast members in the Cast window. There are two methods for creating transitions in Director. The first, choosing Transition in the Effects channel of the Score window, has been with the program since the very beginning. Director 8 introduces a new way of creating transitions: using the new Imaging Lingo feature. These transitions are actually applied to Sprites and are created with Lingo. Director 8 has several built-in sprite transitions that you can find in the Library Palette, where you choose Animation ➪ Sprite Transitions Category. Unlike the transitions applied in the Score window, these new sprite transitions can be applied to individual sprites on the Stage, allowing for some interesting effects that would have been very difficult to achieve in earlier versions of the program. CrossReference
You learn to create your own sprite transitions, as well as many other dazzling effects, by using Director’s new Imaging Lingo in Chapter 27.
Choosing a transition is mostly a matter of aesthetics. You can choose from a variety of transitions, ranging from the subtle to the dramatic.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 305
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-5: Transition effects transform one image into another.
Choosing a transition Although a complete transition effect takes only the span of a single frame in a Director movie, you can specify the amount of time for the transition and the smoothness of the transformation. You choose the effect you want to use from the library of transitions included with Director (see Table 8-2). Transitions in Director are grouped by category for ease of selection and use, but each transition is unique in the way it appears. In addition, some transitions — such as Dissolve and those in the Other category — consume more of the computer’s resources than other transitions do. Because they require more memory to render the images to the screen, they can cause performance problems if your entire movie is resource intensive overall, or if your movie is playing on a computer with limited resources.
305
3486-6 ch08.f.qc
306
7/24/00
5:45 PM
Page 306
Part II ✦ Bringing It All Together
Table 8-2 Transition Effects Transition Category
Description and Available Options
Cover
Covers the first image with the image in the subsequent frame by sliding the image over it. You can specify the direction of the transition, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Dissolve*
Dissolves from one image to the image of the subsequent frame, with a pixelated transition. You can choose the type of pixelation, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Other
Uses one of a miscellaneous collection of transitions, including checkerboard, random columns, random rows, blinds, and zoom effects, to change from one image to the image in the subsequent frame. You can choose the type, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Push
Pushes one image from view using the image from the subsequent frame. You can choose the type, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Reveal
Strips away one image to reveal the image in the subsequent frame. You can choose the direction, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Strips
Removes one image, a strip at a time, to reveal the image in the subsequent frame. You can choose the direction, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
Wipe
Smoothly wipes one image away to reveal the image in the subsequent frame. You can choose the direction, the smoothness, the amount of time, and whether the transition applies to the changing area only or to the entire Stage.
*Dissolve transitions have a different appearance on the Macintosh and in Windows. If you are creating a crossplatform movie, you should test the transition on both platforms.
In addition to the transitions packaged with Director, a number of third-party vendors offer additional transitions that you can add to Director as Xtras. Xtra transitions are indicated with special icons in the Frame Properties: Transitions dialog box. You
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 307
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
install Xtra transitions by placing them in the XTRAS folder in the Director application folder (see Chapter 24 for more information). After they are used in the Score’s transition channel, they appear in the Cast window just like any other cast member. Note
Transition Xtras, like other Xtras, must be included with your movie when it’s distributed.
Applying and controlling a transition Transitions — like tempos, palettes, and sounds — have a channel set aside for them in the Score and are placed in the frame where you want the transition to begin. Before you select the frame in which you want to set a transition, it’s important to understand how transitions work. Note
A transition always takes place between the end of the current frame and the beginning of the frame where the transition is set. If you want to add a transition between two scenes, you must place the transition in the first frame of the second scene, not in the last frame of the first scene.
Tip
If you want to use sound during a transition, place the sound in a frame earlier than where the transition is placed. This gives the sound time to decompress and load prior to the rendering of the transition. It makes for a smoother transition.
When you apply a transition, you can set a variety of options that affect the appearance of the transition. Each transition has a particular set of options; only the options available for a specific transition are available in the Frame Properties: Transition dialog box. (The Description column of Table 8-2 includes the options available for each category of transition.) Descriptions of the available controls in the Frame Properties: Transition dialog box are: ✦ Duration: You can specify the amount of time, in seconds, over which you want the transition to render to screen. Shorter transition duration creates more abrupt changes; longer duration creates gradual changes and is more resource intensive. ✦ Smoothness: By adjusting the smoothness, you can control the chunk size of the transition. Chunk size is the number of pixels affected at a time. (Although the Smoothness slider in the Frame Properties: Transition dialog box doesn’t reflect numbers, you are actually choosing a chunk size between 1 pixel and 128 pixels.) You adjust the Smoothness slider to the right to reduce the number of pixels and increase the smoothness of your transition. Adjust the slider to the left to increase the number of pixels in the chunk size. Smoother transitions use up more resources and render more slowly than transitions that use a larger chunk size.
307
3486-6 ch08.f.qc
308
7/24/00
5:45 PM
Page 308
Part II ✦ Bringing It All Together
✦ Affects: Entire Stage: This option changes the entire Stage. Although this is a slower and more resource-intensive transition, it is more attractive when the background is a bitmap image. ✦ Affects: Changing Area Only: This option changes only that portion of the Stage that actually changes. It is a good choice when transitioning to a digital video, or when changing text on the Stage. To increase the speed of a transition, consider enlarging the chunk size of the transition instead of reducing the duration. The number of pixels has more impact on speed than does the number of seconds for the transition.
Tip
In addition to these options, others may be available if you are using an Xtra as a transition. If an Xtra has other options, the Options button is highlighted in the Frame Properties: Transition dialog box. On the CD-ROM
You can use any movie you want for the next exercise, or you can use the marspics.dir movie on the CD-ROM in the EXERCISE:CH08 (EXERCISE\CHO8) folder.
Adding a Transition 1. Open your movie in Director if it’s not already open. 2. Open the Score window by choosing Window ➪ Score. 3. Double-click the Transition channel in the frame in which you want to place a transition. The Frame Properties: Transition dialog box appears (see Figure 8-6).
Figure 8-6: Select and control transitions in the Frame Properties: Transition dialog box.
4. Choose the transition category and transition you want to use. If you click All in the Categories list box, all the available transitions appear in alphabetical order in the Transitions list. 5. Set the Duration, Smoothness, and Affects options.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 309
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
6. Click OK to complete the operation and return to Director’s main window. 7. Rewind your movie and click the Play button to test your transition. If you want to change the transition, double-click the transition in the Score window, and make any changes you want. After you set a transition, it appears in the Cast window as well as in the Score. If you want to reuse the transition later in your movie, simply drag the transition from the Cast window to the Transition channel of the frame in which you want the transition to start. If you double-click the transition member in the Cast window, you can modify settings for the transition. This globally changes the settings to every transition in the Score window that is based on the selected cast member. It’s also a good practice to give the transition cast member a more meaningful name to make it easier to identify the transition later on in the movie-creation process.
Tip
Caution
Transitions may not be preserved if you are exporting your file to digital video, and they are ignored when used with movies in a window (MIAWs). To ensure the successful distribution of your movie, test your transitions carefully to make sure they function in a digital video. For more information about transitions and MIAWs, see Chapter 23.
Sprite transitions Until the release of Director 8, users of the program were limited to using the builtin transitions or relied on Xtras to add some variety to their movies. If you wanted to create a transition such as a soft edge-wipe, where one image wipes on top of another as a series of blended images (a technique used often in the days of large multiprojector slide shows), you had to build each transition as a series of composited bitmaps that were then played over several frames in the movie. Not only did it take hours to hand-build these effects, but it greatly increased the movie’s file size, because each transition was made up of several large bitmap images. Then you hoped and prayed the art director didn’t decide to change one of the images in a transition, causing you hours of rework. New Feature
The Sprite Transition behaviors are built using Director’s new Imaging Lingo. You can use these Lingo commands to manipulate individual pixels of bitmap images. This new feature is so comprehensive that all of Chapter 26 is dedicated to it.
Director comes with several behaviors that you can find by choosing Animation ➪ Sprite Transitions Category in the Library palette. Unlike the built-in transitions that you apply in the effects channel, sprite transitions are applied to individual sprites. Each transition contains parameters that control when the transition appears, its duration, and other specific attributes that control the way it acts. Unlike transitions applied in the effects channel, the sprite transition behaviors occur over a span of frames in your movies. One advantage to using sprite transitions is that several transitions can be used simultaneously.
309
3486-6 ch08.f.qc
310
7/24/00
5:45 PM
Page 310
Part II ✦ Bringing It All Together
In the next exercise, you apply the Pixelate Sprite Transition behavior to two sprites in order to create the illusion of two images pixelating from one to another. You also apply the Soft Edge Wipe Sprite Transition behavior to a sprite to give the illusion of a vertical row of lights turning on from the bottom to the top, and then turning off from the top to the bottom. On the CD-ROM
For the following exercise, you need to use the spritetrans.dir movie on the CD-ROM, in the EXERCISE:CH08 (EXERCISE\CHO8) folder. The spritetrans.dir movie is a partially complete movie that already includes the Pixelate and Soft Edge Wipe behaviors, which you can find by choosing Animation ➪ Sprite Transitions Category of the Library Palette.
Using Sprite Transitions 1. Open the spritetrans.dir movie, and then open the Score window. 2. Select the Sprite called Noctis Labyrinthus, click on the Behavior pop-up menu in the Score window, and choose the Pixelate behavior. 3. When the Parameters dialog box appears, set the following parameters, as shown in Figure 8-7. The Transition should be set to appear at the End of Sprite for a duration of 10 frames. The Lowest resolution for both the horizontal and vertical directions should be set to 5, and the Minimum Pixel Dimension should be set to 25.
Figure 8-7: Set the parameters for the Pixelate behavior.
4. Select the Olympus Mons sprite in the Score window and apply the Pixelate behavior. Set the parameters to the same values as the ones set in Step 3 except for the When Transition Appears parameter; set it to Beginning of Sprite. 5. Select the first Light On sprite in channel 10 of the Score window, and choose the Soft Edge Wipe behavior from the Behavior pop-up menu. 6. In the Parameters dialog box that appears, choose Bottom to Top, as shown in Figure 8-8, for the direction. You can leave the rest of the parameters at their default settings. 7. Now select the next Lights On sprite in channel 10 of the Score window, and apply the Soft Edge Wipe behavior. This time, choose top to bottom as the direction and click OK.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 311
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-8: Set the direction that the effect will travel to bottom to top.
8. Rewind the movie and play it back. Press the Next button and note how the images appear to pixelate and the vertical bar of lights light up from the bottom to the top and then from the top to the bottom. 9. Try different settings in the parameters, using either the Property Inspector or the Behavior Inspector, and play the movie back to see how they affect the transitions. If you stopped the movie before it finished executing the transitions, you may have noticed several cast members in the Cast window that were not previously there. This is happening because Director is creating a series of new cast members for the transition. It then deletes them from the Cast window after the transition executes. Caution
If you stop the movie before a sprite transition has finished executing, you should delete the cast members that were created. If you don’t, your movie’s file size could be dramatically increased.
You need to be very careful using sprite transition behaviors, because they can be very resource intensive, especially if you are using them on large bitmaps. Used sparingly, they can be a great way to quickly create some fantastic illusions in your movies.
Working with Color Color is one of the most complex and least understood topics in computer graphics. Among the myriad color issues that affect Director, one of the most critical is crossplatform color shifting. The bad news is that every platform, monitor, video adapter, computer, and piece of software interprets color just a little differently from the rest. The result can be like trying to find identical snowflakes in a blizzard. The primary determining factor for all color issues is your audience. By accurately assessing your audience, color issues become a matter of matching color considerations with the viewers’ needs and resources. To begin the process of addressing your specific audience, you must first understand how color and color palettes work.
311
3486-6 ch08.f.qc
312
7/24/00
5:45 PM
Page 312
Part II ✦ Bringing It All Together
Movies for a Director book audience Most of the Director movies created for this book were created using Director’s RGB color space and use quite a few 24- and 32-bit images with alpha channels. Before deciding on this approach, we first considered the audience — multimedia authors, graphic designers, and programmers — who typically use more powerful computers than the average home user. We also knew that the Director movies that we were building for the book were going to be fairly short, because each movie was built to concentrate on a specific feature in Director. These combined factors helped us determine that using high-quality 24- and 32-bit images for the Director movies was the best approach for this audience.
First, a little color theory Computers read data in bits. A bit is the smallest unit of binary data. At its simplest level, a computer interprets color as either 0 (off), or 1 (on), or 1-bit color. Normally, 1-bit color is black and white. In reality, all color is described in 0s and 1s — 2-bit color, for example, creates four possible color choices: black, white, and two shades of gray. Color is created by translating and interpreting each bit, using a color table of possible colors. As the number of bits increases, there is geometric growth in the permutations of colors that can be achieved. Director supports a variety of color depths, as listed in Table 8-3.
Table 8-3 Color Depths and Supported Colors Color Depth
Number of Colors Supported
1-bit
2 colors (black and white)
2-bit
4 colors (usually black, white, and two grays)
4-bit
16 colors
8-bit
256 colors
16-bit
65,535 colors
24-bit
16.7 million colors
32-bit
16.7 million colors with a 256-grayscale alpha channel
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 313
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
The file size of an image grows in proportion to increases in the color depth and the number of colors. If file size is an issue, reducing the color depth of a bitmap can represent huge savings in storage space, as well as improve the Stage refresh rate of your movie. Large files take longer to import, load, and render to screen. They may also be unnecessarily larger than what is required for optimum output. A 32-bit or 24-bit color image looks wonderful and enables you to take advantage of alpha channels, but if you intend to use it in a Director movie that is to be played back over the Web, you need to consider the price in file size and download time.
RGB color versus Palette Index color Director 8 has two ways of using and displaying colors in a movie: RGB (red, green, blue) color and Palette Index, which is the color space that was used in previous versions of Director. The Palette Index method of displaying colors assigned each color to a specific position in a 256-color palette. RGB color assigns a hexadecimal number to each color that specifies the amounts red, green, and blue needed create the color. When a movie plays in thousands or millions of colors, Director always displays the RGB colors correctly. When a movie plays in 256 colors, Director uses the closest color in the current palette to approximate the original RGB color. At first, RGB color takes a little getting used to (especially if you are an experienced Director user accustomed to the Palette Index color space). The best way to understand RGB color is to show you how it works. Note
For the next exercise, set the color depth of your monitor to 256 colors.
Comparing Index Palette Color and RGB 1. With your monitor set to display 256 colors, create a new movie in Director. 2. Open the Movie Properties dialog box by choosing Modify ➪ Movie ➪ Properties, or press Command+Shift+D (Ctrl+Shift+D). You can also select the Movie Properties by clicking the Movie tab in the Property Inspector. 3. In the Property Inspector, select System – Mac as the default palette, and then click the Palette Index radio button. The movie now uses the Macintosh 256-color System Palette to assign colors to an element. 4. Open the Floating Tool Palette by choosing Window ➪ Tool Palette, or press Command+7 (Ctrl+7), and draw a filled shape on the Stage. 5. Make sure that the shape is still selected, and choose the dark blue color (Index 240) located in the bottom-left corner of the color palette for the shape, as shown in Figure 8-9.
313
3486-6 ch08.f.qc
314
7/24/00
5:45 PM
Page 314
Part II ✦ Bringing It All Together
Index palette color number
Figure 8-9: When using Index Palette color, Director uses an index color number to define the color.
6. Open the Score window (you might need to click the Hide/Show Effects button to display the Effects channels), and double-click the Palette Effects channel in frame 1 to display the Frame Properties: Palette dialog box. Select the System – Win palette from the Palette pop-up menu, and then click OK to return to Director’s main window. Note
The Palette channel is located in channel 2 of the Effects channels.
7. The shape has now changed to a salmon pink color. Because the shape is assigned a color number (color number 240 in this case), it applies to the shape whatever color is currently present in position 240 of the designated palette. 8. Delete the Windows System Palette from the Palette effects channel by clicking it and pressing the Delete key. Select the shape again, and it turns back to its original color. You may need to move the playback head to clear the previous palette from memory. Note
Now you are going to set the movie to RGB color. This time, Director defines the selected color as an RGB color. When you apply a different palette, Director reassigns the RGB color to the Palette Index color that most closely matches the original RGB color. It’s also important to understand that this visual interaction between RGB color and indexed palette color is only relevant when the computer monitor’s color depth is set to 8 bits or lower. At 16 bits or higher, all colors on the Stage are displayed in RGB, regardless of any setting in the Palette Effects channel.
9. Open the Movie Properties dialog box and click the RGB radio button.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 315
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
10. Select the shape on the Stage, and then click on the Forecolor swatch in the Tool Palette. This time, the color number is displayed as an RGB color number, as shown in Figure 8-10. 11. Repeat Step 6 to apply the Windows System palette to the Palette Effects channel in frame 1.
RGB hexadecimal color number
Figure 8-10: The color number is now assigned an RGB color number.
12. Note that the shape did not change to a new color. With the shape selected, click the Foreground color swatch on the Tool Palette. The color that has been applied to the shape has been remapped to the color in the Windows System palette that is the nearest match (exact in this case) to the original RGB color (see Figure 8-11).
Remapped color Figure 8-11: Director finds the color in the current palette that is the nearest match to the RGB color values.
315
3486-6 ch08.f.qc
316
7/24/00
5:45 PM
Page 316
Part II ✦ Bringing It All Together
If you are an experienced Director user, you know that RGB color is a vast improvement over the Palette Index color space that was the only option in earlier versions of the program. Using RGB color doesn’t mean that you can now ignore color palettes. Eight-bit bitmaps that are mapped to a specific palette still might have unexpected color shifts if they are mapped to a different palette, even if you are using RGB color. Because RGB colors are mapped to the current palette, Director has to find a color in the current palette that approximates the original RGB color. Quite often, you still have to use images that are indexed to a color palette for most of your movies, if for no other reason than to trim the file size of your movies so that they play back smoothly. Director movies that consist entirely of 24- and 32-bit images will bring most lower end or older computers to their knees.
Assigning images to color palettes Director’s color palettes are far more than virtual boxes of crayons. Frequently, palettes are designed and intended for a specific purpose. The NTSC palette, for example, was designed to provide a standardized palette for the broadcast video industry. Other palettes, such as the system palettes for Macintosh and Windows, are the default palettes for those platforms. Director enables you to assign a specific color palette (called remapping) to your images when you import the images. If your image was created using a custom (adaptive) color palette and you choose not to remap the image, the palette is imported with the image and placed in the Cast window. We don’t recommend the use of custom or adaptive color palettes, however. When Director encounters a custom palette in a frame of your movie, it remaps all of the active Stage elements to that palette. A palette that was perfect for one element in your movie might look positively horrid when applied to other elements. If you want to use a custom palette, be sure to test it thoroughly with the other elements in your movie, as well as on the anticipated target platforms. Tip
Caution
If you do want to use custom palettes in your movies, one of the best ways to create a custom palette is to use a graphics-processing program such as Equilibrium’s Debabelizer. Debabelizer can create what it calls a Super Palette — essentially a single palette that uses the common colors found in a series of images — that can be used for all of the images that are in your movie. Director can display only a single palette in any given frame of your movie. If the elements of your movie use different palettes, you run the risk of conflicts. Your movie may crash if a palette conflict occurs due to images that use multiple palettes in a frame.
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 317
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Macintosh or Windows or both? Macintosh and Windows don’t display color in the same way. If you are creating a crossplatform movie, you’ll notice a dramatic difference between the way your movie looks on the Macintosh versus the way it looks in Windows. The main reason for this is that both platforms use a different Gamma (light intensity) to display color. Although you can’t change the way the two platforms differ in color interpretation, you can minimize the impact on your movies. When you are creating a cross-platform movie, it’s a good idea to select one palette and use it for the images on both the Macintosh and Windows versions of your movie. At the risk of starting a platform war, we generally think it’s best to use the Macintosh system palette. The reasoning behind this choice is simple: The Macintosh system palette has a broader range of colors than the Windows palette.
On the CD-ROM
In the next exercise, you import images into Director and remap the colors. We have provided several images that you can use for this exercise. You can find them on the CD-ROM in the EXERCISE:CH08:IMAGES (EXERCISE\CH08\IMAGES) folder.
Note
To be prompted to set a color palette for the images that you are about to import into your movie during the following exercise, your monitor must be set to display 256 colors. The color depth setting of your monitor determines the Stage color depth in Director, which determines whether Director needs to attach an indexed color palette to the image.
Remapping Images When Importing 1. Open a new movie in Director by choosing File ➪ New ➪ Movie. 2. Choose File ➪ Import to display the Import Files dialog box (shown Figure 8-12), or click the Import button on Director’s toolbar. 3. Select the files you want to import, and click the Add button to move them to the file list. You can also double-click a filename to automatically add it to the file list. 4. Click Import. The Image Options dialog box appears (see Figure 8-13). 5. Choose the palette options that you want to use. If you want to remap your image to a specific palette, choose the palette from the drop-down palette list, and then click the Remap to radio button.
317
3486-6 ch08.f.qc
318
7/24/00
5:45 PM
Page 318
Part II ✦ Bringing It All Together
Figure 8-12: Select the files that you want to import.
6. If you want all of the images to be imported using the same options, check the Same Settings for Remaining Images checkbox.
Figure 8-13: Select the Image Options that you want to use.
7. Click OK to import the images and return to Director’s main window. Caution
If you remap 32-bit images that contain alpha channels (transparency) to 8-bit color, the images no longer contain an alpha channel when they are imported into Director.
Remapping images on import enables you to quickly change the palette for bitmap images before they are placed in the Cast window. You can also change the palette of existing bitmap cast members, using the Transform Bitmap command. With this command, you can choose to remap the image or specify dithering. If you choose Dither, Director attempts to match the existing colors of the image as closely as possible to the existing palette by interspersing multiple colors from the new
3486-6 ch08.f.qc
7/24/00
5:45 PM
Page 319
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
palette that closely match the original single color. In addition to changing the palette an image uses, the Transform Bitmap command enables you to change the color depth and size of the image. Caution
The Transform Bitmap command can’t be undone. If you are unhappy with the results, you need to reimport the image into the cast.
Transforming Bitmaps 1. In Director, open a movie that contains images you want to remap, if it’s not already open. 2. Choose Window ➪ Cast to display the Cast window. 3. In the Cast window, select the bitmap cast members you want to transform. 4. Choose Modify ➪ Transform Bitmap to display the Transform Bitmap dialog box (see Figure 8-14).
Figure 8-14: Changing the color depth, size, and palette for your image
5. Select a palette from the Palette list. 6. Click either the Remap Colors radio button or the Dither radio button. 7. To resize your image, either enter a new value in the Scale percentage box or type new values into the Width and Height boxes. If you check Maintain Proportions, you need to enter only one value; Director calculates the other (width or height) values to maintain the aspect ratio of the image. 8. Click OK to transform the bitmap. A warning box appears that tells you the operation is irreversible, and asks you to confirm your command. Click Transform to continue or Cancel to quit. The Transform Bitmap command is useful for quickly modifying your bitmap images. If you’re reducing the size of an image by a small percentage (25 percent or less), Transform Bitmap is an effective choice. If you need to make larger changes or enlarge an image, resize the image in an external editor, such as Adobe Photoshop.
319
3486-6 ch08.f.qc
320
7/24/00
5:46 PM
Page 320
Part II ✦ Bringing It All Together
Color palettes and the Web When playing in a Web browser, Shockwave movies don’t control the color palette of a user’s system as projectors do. Shockwave remaps the colors in Director movies to the most similar colors in the active palette of the user’s system. Generally, the active palette is that of the user’s browser. Therefore, you can get the best color results from your Shockwave movies if you map all the images in your movie to the Web 216 palette that is built into Director.
Modifying palettes In addition to the standard palettes that come with Director, you can duplicate existing palettes and then modify them to create your own custom palettes. This is useful when a movie’s cast members use only a few out of a broad range of colors. For example, if the cast members are using only 24 solid colors out of the 256-color palette, you could create a custom palette, remap all of the cast members to the new palette, thereby reducing the rendering time and file size of the entire movie. Caution
This technique doesn’t work as well for images containing gradient fills.
Note
You can’t modify or edit any of Director’s standard palettes.
Creating a Modified Palette 1. Choose Window ➪ Color Palettes, or press Command+Option+7 (Ctrl+Alt+7). This action displays the Color Palettes window, with the active platform palette in the palette window. In Figure 8-15, the Windows System palette is chosen (in a Macintosh window). 2. To modify the colors in the palette, select a color square and use the up- and down-arrow buttons at the bottom of the window to change the color’s HSB (Hue, Saturation, Brightness). 3. The Create Palette dialog box appears, enabling you to rename the palette (see Figure 8-16). Enter a new name — it’s a good idea to enter a name associated with the cast members in your movie. This makes it easier to remember the palette’s use later. 4. Click OK to return to the Color Palettes window. The new palette appears, with the name displayed in the list box at the top of the window (see Figure 8-17). 5. You can repeat Step 2 and modify any other colors in the custom palette.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 321
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Current Palette Figure 8-15: The Color Palettes window enables you to modify color palettes.
Adjust Hue
System color picker
Adjust saturation Adjust brightness
Figure 8-16: Enter a name for your new color palette in the Create Palette dialog box.
Figure 8-17: The modified color palette’s name appears in the list box at the top of the Color Palettes window.
6. After modifying a palette, be sure to save your movie to preserve the changes you’ve made to the palette.
321
3486-6 ch08.f.qc
322
7/24/00
5:46 PM
Page 322
Part II ✦ Bringing It All Together
You’ve now created the basis for a modified palette. You can edit the palette as needed in a variety of ways, using the tools and command buttons in the Color Palettes window. Table 8-4 describes these tools and their functions in editing your color palettes. Caution
You can map cast members to your modified palette as you would to one of Director’s standard palettes. Be cautious when remapping cast members to a palette, however, because these changes are irreversible.
Table 8-4 Tools and Functions in the Color Palettes Window Icon
Description
Function
Reserve Selected Colors
Reserves selected colors and prevents their use. Useful for restricting effects, such as cycling colors to a selected group of colors.
Select Reserved Colors
Selects colors you have reserved in the active color palette.
Select Used Colors
Scans the cast members to select just those colors used by the cast.
Invert Selection
Reverses the selection. For example, if the selected colors in the palette are those used by your cast, this option reverses that selection and selects the colors that were not used by the cast.
Sort
Enables you to sort colors by Hue, Saturation, or Brightness. Select a range of colors and then click the Sort button to choose the desired parameter from the dialog box that appears.
Reverse Sequence
Reverses the order of the selected colors in the Color Palettes window.
Cycle
Cycles selected colors one square to the left. Creates an effect similar to color cycling. Note: This option is only available for 256-color palettes.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 323
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Icon
Description
Function
Blend
Creates a blend of a selected range of colors. Useful for creating a range of blended colors for use as a gradient. Select a range of colors and then click the Blend button to create the blended range.
Arrow Tool
Selects colors and options in the Color Palettes window. Click a color to select it. Drag to select a range of colors.
Hand Tool
Enables you to drag colors and rearrange their order in the Color Palettes window.
Eyedropper
Enables you to replace a color in the Color Palettes window by selecting the color and then dragging the Eyedropper to the desired color on the Stage.
Hue, Saturation, and Brightness
Adjusts the Hue, Saturation, and Brightness of a color.
Color Picker
Enables you to select colors from the Color dialog box.
Creating effects with palettes You can create effects with palettes much as you can with other sprites in your movie. For instance, using settings in the Frame Properties: Palette dialog box, you can fade a palette to black or white. Fading to black or white is useful for adding closure scenes to your movies. Instead of abruptly ending the movie, the scene gradually fades away. You can also create color-cycling effects. Color cycling works well for a variety of uses, such as making a cartoon character blush by degrees from pink to red, or for creating a headline banner that cycles through several colors. Note
Palette-fading and color-cycling effects are available only if you are using an 8-bit, 256-color palette. You can’t create these effects with higher color depths.
323
3486-6 ch08.f.qc
324
7/24/00
5:46 PM
Page 324
Part II ✦ Bringing It All Together
On the CD-ROM
Note
Try both of these effects in the next two exercises. Use the mplane.dir movie in both sets of steps. The mplane.dir movie is on the CD-ROM in the EXERCISE:CH08 (EXERCISE\CH08) folder.
For the next two exercises, set your monitor to display 256 colors.
Creating a Fade to Black or White 1. Open the mplane.dir movie in Director. 2. To add a palette fade at the end of the movie (from frame 40 to frame 60), click once in the Palettes channel in frame 40. Hold down the Shift key and click in frame 60; this selects all frames from 40 through 60. 3. Choose Modify ➪ Frame ➪ Palette to display the Frame Properties: Palette dialog box (see Figure 8-18).
Figure 8-18: The Frame Properties: Palette dialog box enables you to set up various palette effects.
4. Select the Palette Transition radio button and the Span Selected Frames radio button. 5. In the Options area at the bottom of the dialog box, choose either Fade to Black or Fade to White. 6. Click OK to complete the operation and return to Director’s main window. 7. Save the movie as mplane1.dir. 8. Be sure the Loop Playback button on the Control panel is turned off, so that the movie doesn’t recycle. 9. Rewind the movie, click the Play button, and watch the palette fade.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 325
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Although not specifically a transition like those available through the Frame Properties: Transition dialog box, you can use palette fades to create color transitions both at the end of your movie and between scenes in your movie. Now let’s work with color cycling.
Cycling Colors in Your Movie Caution
Remember that color cycling, like the palette fade, works only when using an 8-bit, 256-color palette. Furthermore, if your monitor is set to use a high-color (16-bit) or true-color palette (24-bit or 32-bit), these effects do not appear.
1. Make sure the mplane1.dir movie is open in Director. 2. Double-click on the System – Mac palette in frames 40 to 60 of the Palette channel to display the Frame Properties: Palette dialog box. 3. Select the Color Cycling radio button and the Span Selected Frames radio button. 4. Leave Options set to Loop. 5. On the color palette in the dialog box, drag across a range of colors to select the colors you want for the cycle. Click OK to complete the operation and close the dialog box (see Figure 8-19).
Figure 8-19: Select the range of colors that you want to cycle through.
6. Save the movie as mplane2.dir. 7. Be sure the Loop Playback button on the Control panel is turned off, so that the movie doesn’t recycle. 8. Rewind the movie, click the Play button, and watch the palette cycle.
325
3486-6 ch08.f.qc
326
7/24/00
5:46 PM
Page 326
Part II ✦ Bringing It All Together
Color cycling can create effects from muted to spectacular, depending on the colors you select to cycle. To quickly highlight and call attention to text in your movie, consider selecting two contrasting colors for the text, and cycle between them with Color Cycling enabled in the Frame Properties: Palette dialog box.
Tip
Building Projectors After you’ve created a movie, you can play it in Director or share it with others who have Director installed on their computers. None of the available media players support Director movies, however. If you want to distribute your Director movie for others to use, you need to create a projector of your movie. A projector is a stand-alone application containing the Director movie packaged with all of the elements required for playing it on a given platform. Director doesn’t need to be installed for the projector to play. Projectors are platform-specific. A projector created on a Macintosh won’t run in Windows. A projector created in Windows 98/NT won’t run on a Macintosh. If you’re creating a movie for cross-platform distribution, you need to create the projector on the platform for which it’s designed to play. This means it’s possible to create two projectors: one for each platform. Projectors are distinct files that bundle your movie, sounds, Xtras, filters, and the run-time engine into one file. Unlike the original Director movies from which they are created, projectors are executable files, which means that the movie starts when you double-click the filename. Caution
Windows users: Projector files have an .EXE extension. The Macintosh OS doesn’t routinely put extensions on files, so you should be careful not to overwrite your Director movie by giving your projector the same name as your Director movie.
Projector movies are, by their nature, larger than their original Director movies. The reason for the difference in size has to do with the number and types of files included in a projector, plus the executable code that plays the movie. It’s not uncommon for a projector to be two to three times the size of its associated Director movie. Note
In Director 8, you can only create projectors with movies that are created with version 8 of Director. If you are including Director movies from a previous version of the program, you need to update them by using the Update Movies Xtra explained later in this section.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 327
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Creating a projector Before creating a projector, it’s a good idea to play your movie one last time to check all the elements of your movie. Although your original Director movie isn’t altered when you create a projector, you cannot edit the projector itself. When you are creating a projector, make sure that any Xtras you used to create the movie are included with the projector. If you are missing an Xtra, your movies may not play properly. You can add Xtras the same way you add movies when creating a projector (covered later in this section), or you can add Xtras with the Movie Xtras dialog box. Follow these steps to add Xtras with the Xtras Movie dialog box: 1. Open the Movie Xtras dialog box by choosing Modify ➪ Movie ➪ Xtras. Most of the commonly needed Xtras are already included, as shown in Figure 8-20. 2. If you need to add an Xtra, click the Add button and choose the Xtras you want to include.
Figure 8-20: The Movie Xtras dialog box enables you to select the Xtras to be included in your projector.
3. Remove any Xtras that you don’t want by selecting them and then clicking the Remove button. This reduces the size of the projector. 4. Select an Xtra and then click the Info button to get information on the Xtras function. Note
When you click the Info button for most of the Xtras, Director launches your Web browser and gets the information from the Macromedia Web site.
5. If you click Download if Needed, the viewer of your movie is prompted to download the Xtra from the Web if it is not on the viewer’s system.
327
3486-6 ch08.f.qc
328
7/24/00
5:46 PM
Page 328
Part II ✦ Bringing It All Together
Another way to include Xtras with your movies is to create an XTRAS folder that contains the Xtras that you are using for your movie(s), creating it in the same folder as the projector. This approach is actually preferred by most professionals. This approach enables you to see which Xtras are included with the movie without having to open the movie in Director. Make sure you do not include the Xtras in the projector if you are using this technique, because the movie crashes if there are two sets of Xtras included.
Tip
When you create a projector, Director asks you to add the movies you want associated with the projector. You can choose to add one or more movies to the list. In addition, you can add cast libraries, Xtras, and other files needed in association with the projector. You can even create a projector that runs several movies in a sequence. Caution
Be careful when adding several movies and files to the projector list. Movies are played back in the same order in which they’re listed. This point is especially critical for projectors that contain movies that play in a separate window (called MIAWs), in which the host movie calls other movies to play. If the order is incorrect, your MIAW could finish playing before its host movie starts, causing the projector to fail. To prevent this from happening, make sure that any host movie that is calling an MIAW is higher in the list than the MIAW.
You can specify a variety of options when you create a projector. These options, accessed through the Options button in the Create Projector dialog box, determine the appearance of the projector and the way the projector is stored for distribution. Table 8-5 lists and describes the various options for creating a projector.
Table 8-5 Options for Creating a Projector Option
Description
Playback: Play Every Movie
When you’re creating a projector that contains multiple movies, choosing this option ensures that every movie plays in turn; otherwise, only the first movie plays. Note: For a projector of an MIAW, do not select this option. If you do, the child movie is left on the screen when the projector has finished playing.
Playback: Animate in Background
Plays your projector regardless of what other applications are active. If you don’t select this option, when you start another application the projector pauses until you click it to restart it.
Options: Full Screen
Blanks out the screen of all other applications and plays the projector full screen. If the Stage does not fill the entire screen, the area outside the Stage is filled with the starting Stage color.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 329
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Option
Description
Options: Show Title Bar
You can select this option only if your projector is playing in a window; the projector displays a title bar with the projector’s name. This also enables the window to be moved.
Stage Size: Use Movie Settings
Causes each movie in the projector to be displayed at its creation size (when the projector contains multiple movies).
Stage Size: Match First Movie
Causes successive movies to be resized to match the Stage size of the first movie in the play order. Be careful when you use this option, because it can cause distortion in your movies. This option is most effective when the Stage size for all movies is the same.
Center
Centers the movie on the screen.
Reset Monitor to Match Movie’s Color Depth (Macintosh only)
Resets the monitor’s color depth to match the color depth setting used for the Director movie.
Media: Compress (Shockwave Format)
Compresses projectors, using the Shockwave compression scheme. This keeps the file size as small as possible, but it increases the load time because the file has to decompress before playing. Shockwave compression can be used for any projector to reduce its size.
Player: Standard
Creates the largest projector but loads the movies the fastest, because the player file does not have to be decompressed.
Player: Compressed
Compresses the player code included with the projector. This substantially reduces the size of the projector. The projector will need more time to launch, because it has to decompress the player file.
Player: Shockwave
Eliminates the need for a player file, because it uses the Shockwave player. If Shockwave is not installed on a user’s system, it automatically prompts the user to download the player from the Web.
Memory: Use System Temporary Memory (Macintosh only)
Enables a movie to use available system memory when the projector’s own memory partition is full.
329
3486-6 ch08.f.qc
330
7/24/00
5:46 PM
Page 330
Part II ✦ Bringing It All Together
On the CD-ROM
For the next exercise, you can use the engine.dir movie found on the CD-ROM in the EXERCISE:CH08 (EXERCISE\CH08) folder.
Creating a Projector 1. Open engine.dir in Director. Choose File ➪ Save and Compact. This operation removes redundant and fragmented data in your movie so that it performs better when it’s played. 2. Choose File ➪ Create Projector to display the Create Projector dialog box (see Figure 8-21).
Figure 8-21: Use the Create Projector dialog box to specify the movies and options that you want to include in a projector.
3. Navigate to and select engine.dir, and then click the Add button to add it to the playback order list at the right of the dialog box. Note
You can also add Xtras by using this method. Locate the folder that contains the Xtras, and add them just as you would a movie.
4. If you are making a projector for more than one movie, you must verify the order in which the movies appear in the Playback Order list box. Click the Move Up or Move Down buttons as needed to reposition selected movies in the list. Remember that movies must be listed in the order in which you want them to play. 5. Click the Options button to display the Projector Options dialog box (see Figure 8-22).
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 331
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-22: The Projector Options dialog box enables you to select the options you want to use with your projector.
6. Select the options (see Table 8-5) you want to use with your projector, and then click OK to return to the Create Projector dialog box. 7. Click Create to display the Save Projector As dialog box. 8. Enter a filename (such as engine) and a location for your projector, and then click OK to continue. Depending on the size and complexity of your movie, it may take Director a couple minutes to create your projector. After the projector is completed, minimize or close Director and then double-click your projector file to test the projector.
Creating a more efficient projector It’s not really necessary to include in the projector all the movies that will be used in your multimedia application. A projector can call other Director movies that are external to the projector. This means you could build a small Director movie that contains only a Lingo script that calls the first Director movie that you are using in your multimedia application. If you take this approach, it’s a good idea to have the projector file at the same directory level as the rest of the Director movies that will be called from the projector. You might want to protect the Director movies that are external to the projector so that users will not be able to open the movies in Director.
331
3486-6 ch08.f.qc
332
7/24/00
5:46 PM
Page 332
Part II ✦ Bringing It All Together
Distributing a projector Projectors tend to be large — even a small projector file is usually larger than what fits on a single floppy disk. Although you can use a compression utility such as StuffIt or PKZip to compress and store your projector on multiple disks, we don’t recommend it. A projector movie contains many component parts, but it is considered a single file, and it’s not a good policy to span a single file across multiple disks. If a single archive disk fails, then your projector becomes worthless. You can use a variety of storage media to distribute your projectors. Only two of them are practical, however. You can either distribute the projector via the Internet as a download, or you can create a CD-ROM containing the projector. If you choose to distribute your projector over the Internet, be aware that the user has to download the file and play it offline. The only way the user can view your movies online is if you create a Shockwave movie (see the “Shocking Your Movies” section below). A CD-ROM capable of holding almost 650MB of data may seem like overkill if you have a 3MB projector, but the potential audience — given the number of people who own CD-ROM drives — might warrant using that medium for distribution. CD-ROM recorders and media are becoming inexpensive and are reasonably easy to operate.
Using the Update Movies Xtra Because you can create projectors with Director 8 movies only, you need to update movies created with previous versions of Director. As well as enabling you to update movies, the Update Movies Xtra performs these functions: ✦ Compresses your movies for faster downloading over the Web. ✦ Removes fragmented data in your movies. The Save and Compact command performs this same operation. ✦ Protects movies to prevent users from opening them. ✦ Batch processes the preceding operations for multiple movies and cast files. To update movies with the Update Movies Xtra, follow these steps: 1. Open the Update Movies Xtra by choosing Xtras ➪ Update Movies. This brings up the Update Movies dialog box, as shown in Figure 8-23. 2. Click one of the three radio buttons next to the Action option — Update, Protect, or Convert to Shockwave Movie(s) — to select the particular operation that you want to perform. • Choose the Update option to update movies that were created with earlier versions of Director.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 333
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
• Choose the Protect option to create Director movies that cannot be opened again in Director. • Choose the Convert to Shockwave Movie(s) option to convert your Director movies to Shockwave movies. This option works the same way as the Save as Shockwave command, explained later in this chapter. 3. Select an option that tells Director what to do with the original files. You can choose Back Up into Folder or Delete. Caution
If you select Delete, Director deletes the source movies you have chosen. This is a quick and easy way to lose many hours of work if you don’t have the original movies backed up to another location.
Figure 8-23: The Update Movies dialog box enables you to specify the Update operation that you want to perform on your Director movies.
4. If you choose the Back Up Into Folder option (we strongly suggest that you always use this option), click the Browse button and select the folder to which you want Director to back up the original movies. Caution
You should always back up the movies into a different folder than the one where the original movies are currently located. When Director updates the original movies, it overwrites the original files with the same name so that the links and references to other movies remain intact. This is especially important if you are creating Protected or Shockwave movies, because you can’t edit them after the movies are updated.
5. Click the OK button when you have chosen the options you want. When the Choose Files to Update dialog box appears, as shown in Figure 8-24, select the movies and cast libraries on which you want to perform the operations. • Click the Add button to add a single file to the list. • Click the Add All button to add all the files in the current folder to the list.
333
3486-6 ch08.f.qc
334
7/24/00
5:46 PM
Page 334
Part II ✦ Bringing It All Together
• To remove a file from the list, select the file and then click the Remove button. • Click the “Add All” Includes Folders check box before choosing the Add All option if you want to include files that are contained inside folders that are located in the Directory that you have chosen. Figure 8-24: Choose the movies and cast libraries that you want to update.
6. When you have added all the files on which you want to perform the operation, click the Update button. Director begins processing the files. It may take several minutes to update the files if you are processing a large number of files. Director saves the new versions of the movies with the same names and locations as the original movies. This ensures that all the links and references that were in your original movies function correctly. If you chose the Backup Into Folder option, Director puts the original movies into the backup folder that you selected.
Shocking Your Movies Shockwave — one of the fastest growing technological advances to hit the Internet — helps Web authors add animation and interactivity to Web pages. Shockwave is now a system-level component (similar to QuickTime) that enables you to play movies over the Web and from the desktop. Shockwave can also play your projectors if you chose that option when creating them. Shockwave 8 is now much easier to install, giving the user more feedback during the installation process. It also automatically updates components as needed. Xtras can now be downloaded from a secure server if they are not installed on the user’s system.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 335
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Director has also included several capabilities that enable you to create multiuser Shockwave applications, such as games and chat rooms. These new features combine to make Shockwave one of the most powerful technologies on the Web.
Designing for the Web Before you create a Shockwave movie, it’s a good idea to check with your ISP (Internet service provider) to be sure that they support the Shockwave file format. The server at your ISP must be able to send information to a user’s Web browser, telling the browser how to deal with files. If your provider doesn’t support the Director or Shockwave MIME-type, users won’t be able to view your movie online. (For more information about Shockwave and the Internet, see Chapter 24.) Caution
The Internet and World Wide Web don’t support multiple windows. For that reason, you can’t use MIAWs in a Web page.
A Shockwave movie can be presented using either Netscape Navigator 3.0 and later or Internet Explorer 3.0 and later (4.01 or later for the Macintosh). When you embed a Shockwave movie in a Web page, you need to create code specific to one or both of these browsers. Director 8 uses the new Publish command to generate the HTML code needed to display your Shockwave movies in a Web page. The Publish command replaces the features found in the Aftershock utility that was shipped with previous versions of the program. If you use Macromedia’s Flash 4, you are probably familiar with the Publish command, because it is nearly identical to the one in Director 8. One big problem with Director movies has always been controlling the speed at which your movie will play across a wide range of computer platforms. This is especially a problem when playing Shockwave movies over the Web, because you compound the problem by adding the user’s connection speed to the Internet into the equation. You can control some of these issues by setting the Playback properties for the movie that lock the frame rate to assure that the movie will play the same across a wide variety of conditions. Director has several built-in behaviors contained in the Library Palette that you can use to control the way a Shockwave movie is downloaded without having to know how to use Lingo programming. For example, you can have the movie loop on an animation in the first frame until the rest of the movie is available. You can also have buttons that are inactive until the frames of the movie to which the buttons navigate are downloaded. There is also a behavior that creates a progress bar that informs the user of the status of the download. You can learn more about these behaviors in Appendix B.
335
3486-6 ch08.f.qc
336
7/24/00
5:46 PM
Page 336
Part II ✦ Bringing It All Together
Compressing individual cast members When creating movies that will be played back over the Web as Shockwave applications, you need to pay special attention to the file size of your movies. Although high-speed connections, such as cable modems and digital subscriber lines (DSLs), are starting to become more widespread, a majority of home Internet users are still using 28.8K through 56K modem connections to view Web content. Most users will ignore even the most compelling Shockwave application if they have to wait more than a few minutes to download it. Director now has a menu item called Optimize in Fireworks that opens a cast member in Fireworks 2.0 or greater, enabling you to use Fireworks to choose and preview the best compression setting for an individual graphic. This feature requires that you have Fireworks 2.0 or greater installed on your system.
New Feature
Graphics usually take up most of the file size in your movies. In previous versions of Director, the only compression option was the default compression used when you created the Shockwave movie. Director 8 has introduced several new methods for compressing the bitmap elements that are contained in the movie. You can set different JPEG compression settings for each individual graphic element, as well as assign global compression for all of the graphics by using Director’s built-in compression scheme. If you have Macromedia’s Fireworks 2.0 or greater installed on your system, you can use the Optimize in Fireworks option, which uses Fireworks’ superior optimizing and preview compression utilities. On the CD-ROM
There are several images found in the EXERCISE:CH08:IMAGES (EXERCISE\CH08\ IMAGES) folder that you can import into a movie to compress.
Optimizing a Bitmap Cast Member 1. In the Cast window, select a bitmap cast member, and then click the Properties button to display the Property Inspector. Click the Bitmap tab if it is not the active window. 2. The Bitmap tab shown in Figure 8-25 has a series of settings, located in the Compression list box, that control the compression for the chosen cast member. Choose from the following options: • Movie Setting: This setting uses the compression setting chosen from the Publish Settings dialog box, which you find by choosing File ➪ Publish Settings. This feature is covered in the “Creating a Shockwave movie” section. • Standard: Uses Director’s standard compression setting. • JPEG: Uses JPEG compression, which you can set via the slider located below the Compression setting list box. The compression settings range from 0 (lowest quality, highest amount of compression) to 100 (highest quality, least amount of compression).
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 337
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-25: Control the compression setting for a cast member in the Bitmap tab of the Property Inspector.
If you have Fireworks installed on your computer, you can click the Optimize in Fireworks button to open the graphic in Fireworks’ export menu, enabling you to choose and view several different compression schemes simultaneously. On the CD-ROM
The next exercise requires that you have Fireworks 2.0 or greater installed on your system. If you don’t have Fireworks, you can find a Fireworks 3.0 demo on the companion CD-ROM in the GOODIES:MACROMEDIA:FIREWORKS (GOODIES\ MACROMEDIA\FIREWORKS) folder.
Optimizing a Bitmap by Using Fireworks 1. In the Cast window, select a bitmap cast member and then click the Properties button to display the Property Inspector. Make sure that the Bitmap tab is active by clicking on it if needed. 2. Click the Optimize in Fireworks button. The Mix Editing In Progress dialog box appears. 3. Another prompt appears, asking if you want to edit an existing Fireworks graphic (see Figure 8-26). If the cast member you are using was originally created in Fireworks and is linked to the movie, click Yes. If you want to edit the cast member that is currently in your movie, click No. 4. The graphic is displayed in the Fireworks Export window, as shown in Figure 8-27. Choose a preset compression setting from the pop-up menu located above the image preview. You can then refine that setting by using the Options tab on the left. If you want to view several settings in order to compare them, click one of the Preview Window buttons located below the image preview.
337
3486-6 ch08.f.qc
338
7/24/00
5:46 PM
Page 338
Part II ✦ Bringing It All Together
Figure 8-26: A dialog box appears, prompting you to choose a graphic created in Fireworks or to use the existing graphic in your movie.
Image settings window
Preview window
File format
Saved preset
Save preset
View tools Export to size wizard Export wizard Transparency Settings
Preview window settings Update and return to Director Frame advance and reverse controls
Figure 8-27: Fireworks enables you to view several different compression settings applied to the same graphic in order to choose the best setting.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 339
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
5. When you are satisfied with the compression setting, click the Update button. Fireworks closes and returns you to Director. Click the Done button in the Mix Editing In Progress dialog box to finish the operation. When you choose the Optimize in Fireworks button, you have access to the Fireworks Export window only. The editing and creation tools are not available. If you set Fireworks as the default editor for bitmaps, you can double-click a cast member and edit by using the entire toolset available in the program.
The Publish settings To display your Shockwave movie in a Web browser, you need to build an HTML page that contains at the very minimum the EMBED tags needed to recognize and load the DCR file that is created when you publish a Director movie as a Shockwave file. In previous versions of Director, you had to accomplish this by creating the HTML code by hand or with an application specifically used to create HTML documents. Director 6.5 introduced a utility called Aftershock, which enabled you to create HTML code that handled your Shockwave movies in a variety of circumstances. Director 8 now has the functionality that used to come with Aftershock built right into the program. Choose File ➪ Publish Settings and use those settings to quickly and easily create very complex HTML documents that set a variety of parameters to control the way a Shockwave movie plays in a Web page. You can set options that automatically download the plug-in or ActiveX control if they are not already installed on a user’s system, display a JPEG image of your movie, or play your movies as Java applets. The Publish Settings menu also enables you to set a global compression setting that is applied to all of the bitmap graphics in your movies that have their compression property set to use the movie’s compression settings. Access the Publish Settings menu by choosing File ➪ Publish Settings. Depending on the HTML template you have selected, up to six tabs are visible in the menu, as shown in Figure 8-28. You can modify individual settings applied to an HTML template by adjusting the properties found in the tabs that are enabled for each template. Figure 8-28: Use the Publish Settings menu to control how your Shockwave movies will be displayed in a Web browser.
339
3486-6 ch08.f.qc
340
7/24/00
5:46 PM
Page 340
Part II ✦ Bringing It All Together
You use the six tabs listed in the Publish Settings menu — Formats, General, Shockwave, Compression, Shockwave Save, and Image — to control various aspects that determine the way the Shockwave movie plays in a browser window.
The Formats tab Use the Formats tab to: ✦ Select an HTML template that the Shockwave movie will use, or create a Shockwave movie without an HTML document. Table 8-6 explains each of the HTML templates. ✦ View a short description of the currently selected HTML template. ✦ Set the path to where the Shockwave, HTML, and Image files are to be saved. If you want to assign a new path, either type in the path name or click the Browse button and select the folder in which you want to save the files. ✦ Determine whether the file will automatically launch in a Web browser when it is output.
Table 8-6 HTML Templates for Embedding Shockwave Movies Template Name
Description
No HTML Template
Creates a Shockwave movie with no associated HTML template.
Shockwave Default
Creates an HTML document that contains the basic OBJECT and EMBED tags needed to display the Shockwave movie in a browser.
Detect Shockwave
Creates an HTML document that uses JavaScript and VBScript to detect the Shockwave plug-in or ActiveX control. If the correct version is not present on the user’s system, the viewer is advised to update the viewer’s Shockwave installation.
Fill Browser Window
Generates HTML code that enables a Shockwave movie to expand in size to entirely fill a browser window.
Java
Creates HTML code that enables the movie to be loaded into a Web browser as a Java applet. Note: Many Director features are not supported in Java.
Loader Game
Displays a Breakout-style game with progress bar while the Shockwave movie is preloading.
Progress Bar With Image
Enables you to assign a background JPEG image that is displayed behind a progress bar while the movie is loading.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 341
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Template Name
Description
Shockwave With Image
Creates an HTML document that automatically substitutes a JPEG image if Shockwave is not installed on a user’s system.
Simple Progress Bar
Displays the Macromedia logo over a progress bar while the movie is loading.
Center Shockwave
Creates an HTML document that puts the Shockwave file in a table in order to center the movie on the Web page.
The General tab You use the General tab, shown in Figure 8-29, to set the dimensions of the Shockwave movie and to set the background color that will be used in the HTML page. Choose from the following Dimensions options: ✦ Match Movie: This setting matches the dimensions that are used for the Director movie that is being output as a Shockwave file. ✦ Pixels: When you choose this setting, the Shockwave movie’s dimensions are set to the exact pixel dimensions typed into the Width and Height fields. ✦ Percentage of Browser Window: This setting displays the Shockwave movie, using the percentages entered into the Width and Height fields. This setting has no effect if No Stretching is selected in the Stretch Style Option of the Shockwave tab. Caution
If you are using the Percentage of Browser Window option, the graphic elements used in your movie should largely be comprised of vector shapes that can scale up and down. Bitmap graphics could appear distorted if you use this option.
Figure 8-29: Use the General settings to set the dimensions of the movie and the background color used for the HTML page that displays the Shockwave movie.
341
3486-6 ch08.f.qc
342
7/24/00
5:46 PM
Page 342
Part II ✦ Bringing It All Together
Choose the color used for the page background from the color swatch, or type a hexadecimal color number into the text field.
The Shockwave tab You use the Shockwave tab, shown in Figure 8-30, to set the properties of your Shockwave movie, which determine how the movie will play back. You can control the way the movie will load. You set the Stretch style (how it fills the browser window) of the movie. You can choose the background color of the window in which the movie is displayed. In addition, you can select an option that enables the movie to use external JavaScripts. Figure 8-30: The Shockwave tab enables you to set properties that determine how the Shockwave movie loads and plays in a Web browser.
Set the following properties in the Playback controls section: ✦ Volume Control: This option enables users to adjust the volume of the audio. ✦ Transport Control: Add a transport controller that enables users to Rewind, Stop, Start, and step through the movie. ✦ Zooming: You must select this option if you want the movie to be stretchable. ✦ Save Local: Enable this option if you want users to able to save the movie to their computer’s hard drive so that they can play it back using Macromedia’s local Shockwave player, which is called Shockmachine. The Loading properties set the elements shown in the movie while it is downloading: ✦ Display Progress Bar: Setting this option displays a progress bar that indicates how much of the movie has downloaded. ✦ Display Logo: This option displays the Macromedia logo along with the progress bar while the movie is downloading. The Stretch Style settings control the way the movie will be displayed in the Web Browser: ✦ No Stretching: The movie plays at its original size.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 343
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
✦ Preserve Proportions: This option displays the movie at its original aspect ratio, no matter what size it scales to fill the user’s browser window. The movie originates both horizontally and vertically from the settings used in the Stretch Positions pop-up menu. Note: Zooming must be enabled. ✦ Stretch to Fill: The movie stretches to fill the height and width variables set in the HTML document used to embed the movie. If the height and width are not proportional to the original movie, sprites on the Stage could appear distorted. Note: Zooming must be enabled. ✦ Expand Stage Size: This option sets the movie’s Stage size to the height and width variables set in the HTML document. The sprites remain at their original size. The movie originates both horizontally and vertically from the settings used in the Stretch Positions pop-up menu. Note: Zooming must be enabled. You use the Stretch Position settings to determine alignment of the movie when one of the Stretch features is enabled. Choose from Left, Center, or Right for the Horizontal alignment, and from Top, Center, or Bottom for the vertical alignment. You use the Background color setting to set a background color that is displayed in the window that contains the actual Shockwave movie (not the HTML page that contains the movie) while the movie is downloading. Select a color by clicking on the color swatch and choosing a color from the menu or by typing in a hexadecimal color number. If your movie is using JavaScript, you need to enable the JavaScript property. This creates a flag for the Netscape browser to start Java when the movie loads.
The Compression tab The Compression tab, shown in Figure 8-31, is where you set the default compression for the bitmap and audio elements in a movie. Bitmaps that use custom compression set with Property Inspector are not affected by these settings. Figure 8-31: The Compression tab sets the default compression used for the movie.
343
3486-6 ch08.f.qc
344
7/24/00
5:46 PM
Page 344
Part II ✦ Bringing It All Together
Choose from the following settings for Image Compression: ✦ Standard: This setting uses the compression techniques that were used by Director versions 4 through 7. ✦ JPEG: This setting uses JPEG compression for all of the images used in the movie. Adjust the slider to set the amount of compression. The 0 setting yields the highest amount of compression but the lowest image quality, and 100 results in the least amount of compression but the highest image quality. You can apply Shockwave’s audio compression to all of the audio elements in your movie by enabling Compression and choosing the level of compression from the kBits/second pop-up menu. The higher numbers result in less compression and yield better audio quality. You can convert all stereo audio to mono (this cuts most audio file sizes in half). If the cast members contain comment text entered in the Comments field of the Property Inspector, you can have them included in the Shockwave movie by enabling the Comments property. You need to use Lingo to access the comments included in the movie.
The Shockwave Save tab The information in the Shockwave Save tab, shown in Figure 8-32, is used when you are creating a movie that will be downloaded and used locally by Shockmachine. Some of the properties require an understanding of Lingo as well as Java and XML. Following is an explanation of each field in the Shockwave Save tab: ✦ Context Menu: Enable this property if you want to display the standard Shockwave contextual menu when the user Option+clicks (Right+clicks) on the movie while it is playing. ✦ Suggested Category: Type in a Shockmachine category, such as Games, into this field. ✦ Shockwave Title: Enter a title, which then appears in the Shockmachine interface. ✦ Send URL: This setting enables you to specify and override the URL that Shockmachine detects. If nothing is entered, Shockmachine detects the URL of the HTML page that contains the Shockwave movie. ✦ Icon File: Use this field to specify the path and filename of a BMP icon image used by Shockmachine. ✦ Package File: Enter the URL of a text file that is used to provide a list of the URLs that contain all the support files that need to be downloaded with the movie to make it fully enabled on the user’s local machine. ✦ Total Title Size: Enter the number, in bytes, of all the files included with your movie.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 345
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-32: The Shockwave Save tab is where you enter information needed to enable your movies to be played locally on a user’s computer using Shockmachine.
The Image tab The Image tab, shown in Figure 8-33, is only available if you have chosen the Image HTML template in the Formats tab. The Image tab is where you select an image from a frame of your movie to be displayed for users who don’t have Shockwave or ActiveX control on their systems. You type in the frame number of your movie that contains the image that you want to use and set the JPEG compression using the slider. You can also determine whether the image will be downloaded all at once or progressively. Figure 8-33: Use the Image tab to select an image that will be displayed for users who don’t have Shockwave or the ActiveX control installed on their computers.
Setting the playback options Two more things to consider when creating a Shockwave movie are how the movie will stream, and what the ideal frame rate will be for your movie. Shockwave movies can stream, meaning that the movie does not have to be completely downloaded before it starts playing. When creating a Director movie that will be output as Shockwave, you can design it so that some of content can download first and then become active while the rest of the content is
345
3486-6 ch08.f.qc
346
7/24/00
5:46 PM
Page 346
Part II ✦ Bringing It All Together
still downloading. Director has several built-in behaviors that control the way elements of a Shockwave movie will be downloaded. See Appendix B for a detailed description of these behaviors. You can also control the way the movie streams by using the Playback Properties window (choose Modify ➪ Movie ➪ Playback). The Playback Properties window also enables you to lock the frame rate of the movie to the current tempo set in the Tempo channel of the score. You can also have the movie pause when the window that contains the movie is inactive. This feature is useful if you have hyperlinks in your movie that will open another browser window. The movie will be paused while the user has the second window open, and then resume where they left off when they make the window that contains the Shockwave movie active again.
Setting the Movie Playback Properties 1. Open a movie in Director, and choose Modify ➪ Movie ➪ Playback. The Movie Playback Properties window appears, as shown in Figure 8-34. 2. Under the General heading, select the Lock Frame Durations check box to lock the movie’s frame rate to the Tempo settings. Select the Pause When Window Inactive check box to have the movie pause if it is in an inactive window. 3. To have the movie begin playing while it is downloading, select the Play While Downloading Movie option. In the field located below the Play While Downloading Movie option, type in the number of frames in your movie that you want to download before the movie is to begin playing. 4. If you want placeholders to appear in place of any elements that have not been downloaded yet, click the Show Placeholders option.
Figure 8-34: The Movie Playback Properties control the frame rate and streaming aspects of the Shockwave movie.
Publish your movie as a Shockwave movie Now that you have a good understanding of the various ways that you set up your movies to play back in a Web browser, you still need to publish the movie as a Shockwave movie. When you save a movie as a Shockwave movie, it creates
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 347
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
a DCR file that contains the actual code and media elements contained in the movie. An HTML file is also generated, using the HTML template specified in the Publish Settings window that contains the OBJECT and EMBED tags and JavaScript that calls the DCR file. You can preview your movies in a Web browser at any time during the moviecreation process by choosing File ➪ Preview in Browser. This launches the movie using the default Web Browser chosen in File ➪ Preferences ➪ Network.
Tip
It’s a good idea to preview your movie in a Browser window to test all of its functionality before you create your Shockwave movie. Caution
If your movie contains linked media, it may not be displayed properly. This is due to a security limitation that prevents Web browsers from reading files stored on a local computer’s hard drive. If you have linked media, you need to put the movie and all of its linked content in a folder called dswmedia. You can include subfolders in the dswmedia folder as long as the relative path names have not changed. This entire folder — with the finished movie(s) and linked content — will need to be uploaded to a Web server when you are ready to put the project online.
Publishing a Movie 1. Open a movie in Director and set the desired Publish settings, using the Publish Settings menu as described in the Publish Settings section of this chapter. You may want to adjust the Movie Playback settings described earlier. 2. Save and compact the movie by choosing File ➪ Save and Compact. 3. Choose File ➪ Publish. This process may take a minute or two, especially if the movie contains linked casts. 4. If you chose the View in Browser option in the Publish Settings menu, the default Web browser will launch and display the Shockwave movie. Unless you chose a different path in the Publish Settings menu, the Shockwave DCR and HTML files are saved in the same folder where you saved the Director movie from which you made them. After you have created the final Shockwave movie and HTML file, it’s a good idea to test in both Internet Explorer and Netscape. Your movie may work properly in Explorer, yet function differently in Netscape. Further, you should check the movie in Netscape and Internet Explorer on both the Macintosh and Windows operating systems.
347
3486-6 ch08.f.qc
348
7/24/00
5:46 PM
Page 348
Part II ✦ Bringing It All Together
Director’s Shockmachine With Director 7, Macromedia made Shockwave a system-level component similar to QuickTime, which enabled Shockwave movies to be viewed from the user’s hard drive as well as in a Web page. Shockmachine, shown in Figure 8-35, is a Macromediadeveloped application that loosely resembles a game console for playing Shockwave movies. Shockmachine enables users to download and play Shockwave content from their local hard drive. Shockwave was developed primarily to complement their Shockwave.com Web site (http://www.shockwave.com), which contains scores of Shockwave games and animated movies. Originally, Director charged a small fee for Shockmachine; recently, however, the company has made it available free of charge.
Figure 8-35: Shockmachine enables Shockwave movies to be downloaded and played locally from a person’s hard drive.
Creating Java Applets of Your Movies Version 6.5 of Director introduced the capability to create Java files of your movies. Java applets are platform independent and don’t require a special plug-in or ActiveX control. Because Java is an environment separate from Director, there are many features in Director that are not supported by Java. If you are going to create Director movies that are to become Java Applets, you need to be careful about using Lingo code and other features, such as ink effects and transitions, that are not supported in the Java format. Fortunately, Director warns you of any components in the movie that are not supported by Java when you begin to create an applet.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 349
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Creating Java applets of your Director movies can be a somewhat convoluted process. Unfortunately, there is very little documentation about creating Java applets in Director’s online help and manuals, although you can download a PDF document from the Director Developers center on the Macromedia Web site at http://www. macromedia.com. Even though it’s possible to create Java applets without having any Lingo or Java scripting knowledge, you might want to read Chapter 25 to learn some of Java’s basics. There is a profusion of good Java books on the market, as well as many good Web sites dedicated to the subject. Tip
When creating a Director movie that is to become a Java applet, it’s a good idea to use Director’s built-in behaviors — located on the Library Palette in the Java Behaviors category — for the Lingo scripts that are to be used in the movie. These behaviors are Java-safe and save a lot of debugging time when you output the move as a Java applet. You can find more information about the Java behaviors in Appendix B.
You can expect a Java applet to take an additional 10K to 50K of disk space, as compared to a DCR (Shockwave) file. The maximum size for a Director player for Java should not be larger than 100K. Also, keep in mind that Java applets run much more slowly than Shockwave (DCR) movies.
The best uses for Java applets Unless you are both an experienced Lingo and Java programmer, you might want to avoid creating Java applets of complex movies that contain a significant amount of interactivity and animation. However, there are several good uses for Java applets that you can quickly and easily create using Director that require very little or no Lingo and Java programming experience. Use Java applets to: ✦ Create animated Web banner ads. ✦ Build a scrolling ticker tape applet that can contain information that updates while the movie plays. ✦ Create simple animations that require no user interaction.
Saving as Java When you use the Save as Java command, Director creates two files that contain a media file and a class file — these files contain instructions for the player and the movie’s internal data. The media file contains all of the movie’s internal cast members and Score information, such as tempo settings, scripts, and ink effects. The media file has the same name as the Director movie and uses a .DJR extension. The class file contains the movie’s Lingo scripts and the startup code needed to run the movie. If you choose the Create as Source Java option, the class file has a .JAVA extension. If you choose the Compiled Java option, the class file has a .CLASS extension. The illustration in Figure 8-36 shows the process that Director goes through to create a Java applet.
349
3486-6 ch08.f.qc
350
7/24/00
5:46 PM
Page 350
Part II ✦ Bringing It All Together
Source Director movie
Director Export for Java Xtra
Player Files (.class)
movieName.class
Linked Cast Members
movieName.djr
Applet Figure 8-36: The process that Director uses to create Java files.
Director also creates several other files when it creates a Java applet of your movie. The files that have a .CLASS extension are the player files that are needed to run the movie. Director also generates an HTML file that contains the EMBED information and is used to check the movie in a Web browser. Make sure that all of these files are contained in a single directory. Creating a Java applet is a very simple process. When you save your movie as a Java applet, Director generates all the files needed to run the Java applet, including an HTML document that contains the EMBED tag for the applet. The difficult part of creating Java applets is stripping out or substituting features in your movie that are not supported by Java. Follow these steps to output your movie as a Java applet: 1. In Director, open a movie that you want to export. Choose the Java HTML template from the Publish Settings menu. Choose File ➪ Save as Java; the Save as Java dialog box appears, as shown in Figure 8-37. Make sure that any external media that are included in the movie are located in the same folder as the source Director movie.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 351
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
Figure 8-37: The Save as Java dialog box
2. There are two options that you can choose to create a Java Applet: Source Java and Compiled Java. The default setting is Compiled Java. This option converts the Java source files into class files, an intermediate, platform-independent language that can be read by the Java engine contained in a Web browser, and converts the code into a language that the computer understands. The Source Java option creates text files that are essentially the same as a programmer would write. If you are going to add your own Java code to the movie, use the Source Java Option. Note
The Minimize Player Size option removes the code for the features that are not used in your movie. It takes longer to compile the Java applet if you choose this option. The Embed Linked Media option includes linked media in the applet and enables all the elements of the Java applet to be contained in a single download.
3. Click the Options button; the Options dialog box appears (see Figure 8-38), enabling you to set the JPEG quality of the images that are used for the Java applet; determine whether the movie loops or pauses at the end; and set specific optimizations. Click OK after you have chosen the options that you want. Figure 8-38: Set options that determine the image quality, playback options, and optimization settings for the Java applet.
351
3486-6 ch08.f.qc
352
7/24/00
5:46 PM
Page 352
Part II ✦ Bringing It All Together
Caution
The optimization options can alter the way the Java applet plays back. Most of the settings determine how lists contained in the movie are used in the Java applet. To learn more about these settings and how they can affect a Java Applet, see Chapter 24.
4. Click the Check button to have Director examine the movie and report any errors that occur in the Java applet (see Figure 8-39). Director displays a list of features contained in the movie that are not supported in Java. Click an item in the list, and then click the View button. Director then displays the sprite, script, or effect that’s not supported. Click the Next button to display the next error in the movie. Click the Done button after you have viewed all of the errors. When creating a Director movie that is to become a Java applet, select the Save as Java option and click the Check button as often as possible to find any features contained in your movie that are not supported in Java.
Tip
Figure 8-39: When you click the Check button, Director examines the movie and then displays any features that are not supported in Java.
5. Click the Save button, and Director compiles the movie and creates the files needed for the Java applet. 6. Click the Run button to view the movie in a Web browser. Caution
You must have enough RAM to run Director and your Web browser simultaneously to take advantage of this operation.
You should package the entire set of files as ZIP, CAB, and JAR files to ensure that they play back on different Web browsers. These file formats are compression schemes that are supported by the different browsers. The CAB file is for Internet Explorer, the JAR file is for Netscape 4+, and the ZIP file is for Netscape 3. You can get free utilities from the Web that compress the files into these formats.
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 353
Chapter 8 ✦ Fine-Tuning and Outputting Your Movies
If you are creating Director movies that primarily will be used as Java applets, you should learn more about the Java programming language. Although many features of a Director movie are supported in Java, plenty of them aren’t. Knowing how to use Java enables you to substitute pure Java code for the features that Director doesn’t support.
Summary In Director, you can use a number of techniques to add the finishing touches to a project before outputting movies that can be viewed in multiple media: ✦ Change the tempo of your movie to help create smooth animation sequences and add dramatic pacing to your movie. ✦ The Control Panel provides a quick method of controlling the playback and frame rate of your movie. ✦ You can pause a movie to wait for the user to click the mouse or press a key. ✦ Add transitions to the movie to help it move smoothly from one scene to the next. ✦ You can remap graphic elements in your movie to existing or custom palettes. ✦ By adding fades and using color cycling, you can create transitional effects with color palettes. ✦ Projectors enable others who don’t own Director to see your movies. ✦ You can create Shockwave movies to distribute your projects on the Web. ✦ Create Java applets of your movies that don’t require the Shockwave plug-in or ActiveX control to be viewed in a Web browser. ✦ Use the Publish settings to create robust HTML documents to play your movies over the Web. Now it’s time to move on and use the knowledge you have gained so far to build a fully functional multimedia application.
✦
✦
✦
353
3486-6 ch08.f.qc
7/24/00
5:46 PM
Page 354
3486-6 ch09.f.qc
7/24/00
5:46 PM
Page 355
9
C H A P T E R
Creating an Interactive Presentation
C
reating a Director movie requires advance planning to ensure its success; planning ahead also reduces the amount of debugging and editing required throughout the development of the movie. This chapter examines the anatomy of a movie, from a planning point of view, by creating an interactive presentation. This chapter also shows you other ways to integrate the techniques and operations covered in previous chapters.
Designing an Interface A powerful aspect of Director is its capability to create interactive multimedia applications that give users control over how they want to view the content. Of course, this makes creating your movies much more difficult because you have to consider these aspects: ✦ How to break down the content into parts that make sense to the user ✦ How the user navigates through the content ✦ How to avoid leading the user to a “dead end” from which the user can’t return easily ✦ The number of levels the user will have to navigate The complexity of these issues compounds as the amount of content included in your application grows larger. Here’s a good rule of thumb for creating navigation: The user should not have to click more than three buttons to get to any of the content. If you have a large amount of content to include in your movie, keeping the navigation to three levels can be a daunting task.
✦
✦
✦
✦
In This Chapter Designing an interface Using Guides Using QuickTime VR Using HTML in Director Importing a PowerPoint presentation Launching external movies
✦
✦
✦
✦
3486-6 ch09.f.qc
356
7/24/00
5:46 PM
Page 356
Part II ✦ Bringing It All Together
Another big challenge when designing an interface is that it’s almost impossible to predict how each individual will navigate through the content. Unless you are creating a computer-based learning application or a speaker-support presentation, you should generally avoid presenting your content in a linear fashion. On the other hand, if you have a lot of content, you need to be careful not to create a navigation scheme that looks like the cockpit of a 747 airliner, which simply overwhelms most users. A good interface takes a great deal of thought. If you are creating a multimedia application that contains a large amount of content, you should consider building a rough prototype of the interface and have it tested by your target users. You’ll be surprised at some of the ways users want to navigate through the content.
Creating a flow chart One of the best techniques for creating the navigation scheme for your movie is to create an outline. Most word processors have the capability to create outlines. The advantage to using an outline is that you can easily move subjects to different levels as well as insert new ideas as they occur to you. After you have created an outline, you should create a flow chart of the navigation structure. This gives you an easy way to visualize the navigation structure that the movie is to use. Figure 9-1 shows the flow chart that was created for the movie that you build in this chapter.
Explore Mars Navigation Flowchart Opening Animation
Virtual Tour
QTVR 1
QTVR 2
Mars Lander Game (external movie)
FactFinder
QTVR 3
Mars Facts Screen 1
Web Links
Mars Facts Screen 2 Mars Facts Screen 3 Figure 9-1: A flow chart provides a picture of the navigation that you’ll use for your movie.
3486-6 ch09.f.qc
7/24/00
5:46 PM
Page 357
Chapter 9 ✦ Creating an Interactive Presentation
There are three levels of content in this movie. The first level is an animated opener that introduces users to the content and entices them to venture further into the movie. From the opening animation, the user can choose between three different sections: a QuickTime VR tour of Mars, a section that contains facts and figures about Mars, and a game called the Lander Pilot. The VR Tour and FactFinder screens each contain an introduction to the section and navigation elements that enable users to select any third level of content that most interests them. Because the Lander Pilot game does not have any third level content, there is no need to build an intermediate screen. Even though the navigation for this movie is fairly simple, it’s still a good practice to use a flow chart to visualize the navigation. This is especially important if more than one person is building the application, because it gives everyone a common reference and avoids a lot of confusion later in the project. It also provides an excellent starting point for the next step in the process of building an interactive application — designing the look and feel of the user interface.
Designing the navigation After you have created a navigation flow chart, the next step is to determine how the user navigates to and from each section. The best way to begin is to determine how the navigation structure works. In this situation, we broke down the navigation into two main areas that serve very distinct functions: ✦ The first level of navigation enables the user to jump to the top level of any section from almost any point in the movie. This is accomplished by creating a static area at the top of the screen that’s visible during most of the movie. This area contains buttons that go to the top level of each section — the Virtual Tour, FactFinder, and Mars Lander Game. This area also contains a text header that labels each section. ✦ There are two second-level areas — the Virtual Tour and FactFinder — with options from which the user can choose that lead to third-level content. The navigation elements that enable the user to view the content contained in these sections are located on the left side of the screen. This approach enables a user to navigate through the content in a very nonlinear fashion, and it also ensures that a user is never more than three mouse clicks away from any other third level of content. We intentionally added two elements that present navigation problems into this project. The Mars Lander game is actually a separate Director movie. Although it would be possible to re-create the Navigation bar at the top of the original movie for the Lander Pilot game, it would be very distracting when a user is playing the game. To solve this problem, users drop back into the original movie when they quit the game, to the same place where they chose to play the game.
357
3486-6 ch09.f.qc
358
7/24/00
5:46 PM
Page 358
Part II ✦ Bringing It All Together
The other navigation problem is in the Mars Facts level located below the main level of the FactFinder. The Mars Facts section is actually a PowerPoint presentation that contains three different screens. Because there are only three screens at this level, it shouldn’t be too disturbing to the user to navigate sequentially through the section. After the user navigates to the Mars Facts section, you introduce Next and Previous buttons that enable the user to move forward and back through the three screens.
Laying Out the Project Now that the navigation issues are solved, it’s time to begin laying out the interface. You assign areas on the screen real estate that are dedicated to particular functions; for instance, you should assign a part of the screen as the place where the Quit button is located. Having a main navigation element move to a different position throughout a movie is not very user friendly. When you need to use a secondary level of navigation specific to a section, you still want to present that navigation in a consistent manner. In the VR Tour and FactFinder sections you build later in this chapter, there is a secondary level of navigation buttons that lead to the third level of content. Even though the buttons in each of these main levels leads to a different third-level section, you place them in the same area of the screen and give them an identical look and feel. The only aspect that is different for each of these buttons is the label that informs the user where the button leads when the user clicks it.
Carving up the screen Before you begin creating the movie in Director, you need to carve up the screen, defining the areas of the screen that hold your navigation elements, content, and any special elements in your movie. This can be done with the old No. 2 pencil as a rough sketch (that’s usually the best place to begin), but Adobe Photoshop is an excellent tool for this process. Chances are that you need to create at least some artwork to be used in your movie with an external graphics editor, so you might as well take advantage of Photoshop’s rulers and guides to precisely align the elements designed for the layout of the elements. This approach offers several advantages — the biggest one is that you can actually create the art elements for your movie at the same time as you lay out the project. At the very least, you probably want to design several layouts in a graphics editor that shows what the screens in your movie look like at each level of navigation, as shown in Figure 9-2. If you are creating a large project that involves several team members, you might want to lay out every screen in your graphics editor before it is built in Director. This gives everyone working on the project an exact picture of every screen layout to be produced for the movie.
3486-6 ch09.f.qc
7/24/00
5:46 PM
Page 359
Chapter 9 ✦ Creating an Interactive Presentation
Figure 9-2: Using guides in Photoshop enables you to easily carve out the space needed for the individual elements to appear in your movie.
Creating graphics factories A Director movie can contain hundreds and, oftentimes, thousands of individual graphic elements, especially if you are using multistate buttons and animation composed of many small pieces. Keeping track of all of these elements and ensuring that they are consistent with each other can be one of the most difficult aspects of creating a Director movie. Using a graphics editor, such as Adobe Photoshop, that enables you to store graphic elements in layers, makes your life much easier. You can break down your art elements into different categories, or factories — such as headers, buttons, labels — and then you can create a file for each category that contains all the individual elements needed for each category. Use this technique to create a file that contains each button state as a separate layer. Not only does this help you manage the files, but it also enables you to preview each state of the button (before you bring it into Director) by turning on and off the different layers that contain the state of the button.
359
3486-6 ch09.f.qc
360
7/24/00
5:46 PM
Page 360
Part II ✦ Bringing It All Together
Tip
After you’ve created your layered Photoshop documents, you can copy and paste each layer into Director; or better yet, you can use the PhotoCaster Xtra by Media Lab to automatically import each layer of your Photoshop document into Director as individual cast members.
Getting organized in Director The movie you build in this chapter is actually quite small compared to most Director projects, but there are still over 100 individual elements that make up the final version of the movie. Piling all of these elements into a single Cast window makes creating a movie a very frustrating experience, and you can end up wasting your valuable time trying to find cast members instead of concentrating on the creative aspects of the movie. A better approach is to create several Cast windows that contain specific types of elements that will be used in the movie. There are no hard and fast rules as to how you should structure the Cast windows — whatever method works best for you is fine. The movie you build in this chapter contains the Internal and three additional Cast windows. A description of the Cast windows and a brief explanation of their content is as follows: ✦ Internal: Use the Internal Cast window to store the text, bitmap, and video cast members that are the actual content elements for the VR Tour and FactFinder sections. ✦ Interface: The Interface Cast window contains all the graphic and text cast members that make up the navigation for the movie, including all the buttons, Section headers, button labels, button sound, and navigation bar graphics. ✦ Behaviors: This window contains (obviously) the behaviors and Lingo scripts in the movie. ✦ PowerPoint: This Cast window contains all the cast members that are created when you import the PowerPoint presentation into Director. Tip
Build a directory structure on your hard drive that mirrors the Cast windows used for your movie to store all of the elements to import into Director. This not only keeps you more organized, but it also speeds up importing the elements into Director. You need to be careful about linked media such as digital video — it’s easy for Director to lose track of a linked file that is not located at the same level as the movie. You should keep files that will be externally linked at the same directory level as the Director movie. Alternatively, you can group all the digital video files together in a subfolder within the same directory.
You might be wondering why we didn’t put the PowerPoint cast members in the internal Cast window with the rest of the content elements. When you import a PowerPoint file, Director creates individual cast members for each line of text, transition, and graphic element of the original PowerPoint presentation. This can be quite a few cast members. Having the PowerPoint cast members contained
3486-6 ch09.f.qc
7/24/00
5:46 PM
Page 361
Chapter 9 ✦ Creating an Interactive Presentation
in a separate Cast window makes it easier to identify the elements used for the PowerPoint presentation. You learn how to import a PowerPoint presentation and incorporate it into an existing movie later in this chapter. Now that you have a basic understanding of navigation structure and content, it’s time to begin creating the movie in Director.
Dissecting the movie If you are experienced in Director, you probably already have begun forming a mental picture of the structure of the movie you are about to create. At this point, open the final version of the movie and spend a little time getting familiar with the components before beginning to build the movie. On the CD-ROM
The explore_complete.dir movie is a completed version of the movie you build. You can find this movie on the CD-ROM in the folder EXERCISE:CH09 (EXERCISE\ CH09). You also want to make sure that QuickTime 4.1 is installed on your computer. If you don’t have QuickTime installed, use the QuickTime 4.1 installer on the CD-ROM in the GOODIES:QUICKTIME (GOODIES\QUICKTIME) folder.
Looking Over the Project 1. Open the explore_complete.dir movie in Director. Rewind the movie and play it. 2. Spend a few minutes navigating through all the sections of the movie to familiarize yourself with the way the navigation functions. 3. When you feel comfortable with the way the movie works, click the Quit button. The movie stops playing, but Director is still open. 4. Open the Score window. The first 10 sprite channels are colored orange (see Figure 9-3). These sprite channels contain the main navigation elements for the movie. The sprites that begin in sprite channel 12 are secondary navigation elements. Sprites starting in channel 24 are content elements that are specific to each section of the movie. Tip
When creating movies in Director, carve up the Score window by dedicating certain channels for specific types of elements. For example, sprite channels 1 through 10 could be used for the navigation elements, and content could always begin in channel 15. This makes it easier to locate an individual element later in the project, because you have a general idea of the channel in which it is located. This is a very useful technique to employ if several authors are working on the same project.
361
3486-6 ch09.f.qc
362
7/24/00
5:46 PM
Page 362
Part II ✦ Bringing It All Together
Primary Navigation Elements
Secondary Navigation Elements
Content Elements Figure 9-3: The Score is divided into different sections that contain specific types of elements used for the movie.
Creating the Opening Animation When building an interactive presentation, an important component is the introduction. This is the first thing users see when they launch the application, so it needs to set the scene for the movie as well as entice users to explore the content. The opening animation for the movie you build in this chapter is very simple. It serves as a way to introduce the navigation bar that’s used throughout the rest of the movie. Because the main goal of this movie is to give you an overall approach to building an interactive application, we didn’t want you to spend a large amount of time creating a complex animation for the opening sequence. You will probably want to create a more complex and compelling opening animation sequence when you are creating your own interactive presentations.
3486-6 ch09.f.qc
7/24/00
5:46 PM
Page 363
Chapter 9 ✦ Creating an Interactive Presentation
If your movie has a story line, you could create an animated opener that sets the scene for the story line that runs through the movie. Many games take this approach, using a very sophisticated opening animation that leads you to the point in the story where the game begins. If you create a large opening animation that takes several minutes to view, make sure that you give the user the opportunity to jump to the main content at any time. You might think the animation you created is very compelling, but you can never predict how much patience the user has. You might end up frustrating your users if they are forced to sit through the opening animation every time they run your movie. You can always create a button that plays the opening animation from any point in the movie. Caution
Avoid using digital video for an opening animation, because a certain percentage of your users might not have the capability to play digital video. If you do want to use digital video, you should create an alternate version of the opener that can automatically play in place of the video if the user doesn’t have video capability.
In the following exercise, you begin building the opening animation sequence for the movie. Most of the steps are a review of some of the things that you learned about animating sprites in Chapter 3. The big difference is that you’re going to set guides in Director to make it easier to align two of the sprites on the Stage. On the CD-ROM
For this exercise, use the explore1.dir Director movie. You can find this movie on the CD-ROM in the EXERCISE:CH09 (EXERCISE\CH09) folder. Save this movie to a folder on your hard drive so that you can add to it in other exercises in this chapter.
Building the Opening Animation 1. Open the explore1.dir movie, and then open the Cast window. 2. Click the Select Cast button in the Cast window and choose the Interface Elements cast. Select the cast member named navbar and drag it into sprite channel 1 of the Score window so that it begins in frame 5. Drag the title cast member into the score so that it’s directly below the navbar sprite in channel 2, as shown in Figure 9-4. Tip
If you hold down the Option (Ctrl) key while you click the Select Cast button, the new Cast window opens over the existing one.
3. Open the Property Inspector, shown in Figure 9-5, and click the Guides and Grids tab to display the Guides and Grid window. Make sure that the Visible and Snap to Guides check boxes are enabled.
363
3486-6 ch09.f.qc
364
7/24/00
5:46 PM
Page 364
Part II ✦ Bringing It All Together
Figure 9-4: Drag the navbar and title cast members into the Score as shown.
Vertical guide
Tooltip displaying pixel location Horizontal guide Figure 9-5: Use guides to accurately place sprites on the Stage.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 365
Chapter 9 ✦ Creating an Interactive Presentation
4. Place a horizontal guide onto the Stage by dragging from the Horizontal Guide onto the Stage. Note that the pixel location of the guide dynamically updates in the Property Inspector window. When the Guide is 20 pixels from the top of the Stage, let go of it. Place a second horizontal guide so that is 44 pixels from the top of the Stage. 5. Repeat Step 4 to place a vertical guide so that it is 50 pixels from the left edge of the Stage by dragging from the Vertical Guide onto the Stage. Place another vertical guide 80 pixels from the left edge of the Stage. 6. On the Stage, position the Title sprite so that the upper left corner of the sprite snaps to the outermost horizontal and vertical guides. Then position the navbar sprite so that the upper-left corner of the sprite aligns with the innermost horizontal and vertical guides. 7. Drag the tail of the navbar sprite so that the sprite ends in frame 30. Repeat this step with the title sprite. 8. Open the Cast window and make sure that the Internal cast is visible. Drag the mountains cast member into channel 25 of the Score so that it begins in frame 2. Then drag the tail of the mountain sprite so that it extends to frame 79. Note
You need to have the mountain sprite visible on the Stage until the playback head reaches this frame (79) in order to add another element to the opening animation in a later exercise.
9. On the Stage, drag the mountain sprite so that the bottom of the sprite is even with the bottom of the Stage. At this point, your scene looks similar to the one shown in Figure 9-6. Press Command+L (Ctrl+L) to lock the sprite. Note
The mountains cast member contains an alpha channel that enables it to fade into the background.
10. In the Score window, Shift-click the navbar and title sprites, and then hold down the Option (Alt) key and drag a copy of the sprites until they are located just to the right of the original navbar and title sprites. The new sprites should extend from frame 30 through frame 56. Note
In the next step, you animate the navbar and title sprites. You created a copy of the sprites so that you have a backup of them in their final position, just in case something goes wrong with the animation you are going to create.
11. Click the tail of the navbar sprite in frame 30, and choose Insert ➪ Keyframe, or press Command+Option+K (Ctrl+Alt+K), to insert a keyframe. Then repeat this step for the title sprite channel 2. 12. Click the First frame (frame 5) of the navbar sprite, and then on the Stage, drag the sprite so that it disappears behind the mountains. You should see an animation path that shows the motion of the sprite.
365
3486-6 ch09.f.qc
366
7/24/00
5:47 PM
Page 366
Part II ✦ Bringing It All Together
Figure 9-6: The scene should now look similar to the one shown here.
13. In the Score window, click in the first frame of the title sprite, and then enter –90 in the Sprite Rotation field of the Score window. This value rotates the sprite 90 degrees counterclockwise, as shown in Figure 9-7. 14. Make sure that only the first keyframe for the title sprite is selected, and drag the sprite completely off the left side and down toward the bottom half of the Stage. Tip
You might want to zoom out the Stage so that you can see where you positioned the title sprite off the Stage.
15. To have the mountains transition from black, make sure that the Score window is open, and then double-click frame 2 of the Transition channel. Select a transition from the list. 16. Save the movie as explore2.dir. Rewind the movie and play it back. If the animation plays too slowly, increase the tempo by double-clicking in the Tempo channel and adjusting the tempo speed. You also might want to adjust the Sprite Tweening to make the animation move more smoothly. Click the sprite to select it, open the Sprite Tweening dialog box either by choosing Modify ➪ Sprite ➪ Tweening or by pressing Command+Shift+B (Ctrl+Shift+B), set the parameters that you want in the dialog box, and then click OK to return to Director’s main window. When you are satisfied with the animation, save the movie again as explore2.dir.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 367
Chapter 9 ✦ Creating an Interactive Presentation
Sprite rotation angle
Figure 9-7: Set the rotation angle of a sprite by entering a number in the Sprite Rotation field. Caution
If you adjusted the tempo for the animation, you’ll probably want to set the tempo back to a more normal speed (15 to 30 fps) in frame 31. This setting ensures that any other animations that occur later on in the movie play as you expect them to. You can always set a new tempo speed at other points in the movie, if necessary.
Tweaking sprites Evenly spacing a series of sprites on the Stage by hand can be a time-consuming chore, even if you are using grids. You can use the Sprite Inspector and do the math to calculate the offset, but why do that when you don’t have to? Director’s Tweak window enables you to quickly create an even offset for a series of sprites. Now that you’ve introduced the navigation bar, you need to add the navigation buttons. You use the Tweak tool to quickly create an even offset for each of the buttons. Then you adjust the starting points of the sprites to have them appear on the Stage one at time.
367
3486-6 ch09.f.qc
368
7/24/00
5:47 PM
Page 368
Part II ✦ Bringing It All Together
Using the Tweak Window to Offset Sprites 1. Open the explore2.dir movie in Director and make sure that the Score window is active. 2. Click the tail of the navbar sprite in frame 56, and drag it to frame 79 to extend the sprite. Repeat this step for the title sprite in channel 2. Note
If you didn’t make copies of the sprites earlier, you could Option+drag (Alt+drag) the last keyframe of the original sprites to frame 79. This would extend the sprite the same way as the previous method.
3. Open the Cast window and select the interface elements cast. Locate the navbutton up cast member and drag it into frame 31 of sprite channel 3 of the Score window. Drag the tail of the sprite to frame 79. 4. Make the Stage active, and press Command+Option+S (Ctrl+Alt+S) to open the Property Inspector. Make sure that the navbutton up sprite is selected, and enter 115 into the X position and 78 into the Y position, as shown in Figure 9-8.
X location Y location Figure 9-8: Use the Sprite Inspector to set the location of a sprite.
5. Select the navbutton up sprite in the Score window and Option+drag (Alt+drag) a copy of the sprite to channel 5. Be sure to leave an empty channel between the two sprites. Later you’ll insert the text label for the button in the empty channel.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 369
Chapter 9 ✦ Creating an Interactive Presentation
6. Move the Score window down so that the navbutton sprite is visible on the Stage (it’s on top of the sprite in channel 3), and then open the Tweak window by choosing Modify ➪ Tweak or by pressing Command+Shift+K (Ctrl+Shift+K). Enter 125 in the Horizontal change field and click the Tweak button (see Figure 9-9). Note
There is a major difference between the Sprite Inspector and the Tweak window. The Sprite Inspector fields show actual sprite position on the Stage. Use the Tweak window to enter the change in position that you want to make by typing a number in one of the offset fields, that is, from where it is now and where it will be after the change is made.
7. Option+drag (Alt+drag) a copy of the sprite in channel 5 to channel 7, and click the Tweak button. Option+drag (Alt+drag) a copy of the sprite in channel 7 to channel 9, and click the Tweak button again. Your scene and Score windows look like the ones shown in Figure 9-10. The four button sprites are now on the Stage and are evenly spaced.
Horizontal change field Vertical change field Figure 9-9: Use the Tweak window to offset a sprite.
Figure 9-10: The four button sprites are offset evenly.
369
3486-6 ch09.f.qc
370
7/24/00
5:47 PM
Page 370
Part II ✦ Bringing It All Together
8. To have the buttons appear on the screen one at a time, click the first frame of the sprite in channel 5 and drag it 10 frames to the right. Repeat this step with the sprites in channels 7 and 9, but move these sprites to the right 20 and 30 frames, respectively. 9. Save the movie as explore3.dir, and then rewind and play it. Note that the buttons appear on the Stage one at a time. After you have used the techniques explained in the preceding exercise a few times, you’ll be able to offset a series of sprites in far less time that it takes to read through the exercise.
Animating with a behavior When you looked at the completed version the explore movie, you might have noticed that the text labels for the main navigation buttons appeared to be typed one character at a time onto the screen. You create this effect by using a Library Palette behavior appropriately called the Typewriter Effect. Director’s Library Palette contains many behaviors that are used to animate sprites. These behaviors enable you to create animated effects that would have taken far longer to create in earlier versions of Director. It’s well worth your time to become familiar with all of the animation behaviors found in the Library Palette. Knowing how the behaviors work will enable you to create better movies in less time. Tip
Appendix B contains a description of all the behaviors found in the Library Palette.
All that’s left to do to complete the opening animation is to add the text labels for the navigation buttons and have them appear to type onto the screen. In the preceding exercise, you left an open sprite channel between each of the navigation buttons — this is where you insert the label cast members for each button. Because all the navigation buttons use a single cast member, it is easy to apply the wrong Go To marker parameter when you apply the button navigation behaviors later. To make life easier, we name the text cast members used for the button labels after the section of the movie to which the button jumps. This reduces the chances of making a mistake when you apply the button behaviors, because you can look at the sprite directly below the button to know to which section the button should jump.
Animating the Text Labels 1. Open the explore3.dir movie that you saved in the preceding exercise in Director. Make sure that the Score and Cast windows are visible. 2. Select the interface elements cast and locate the cast member called Tour nav text (it should be in cast slot 41). Drag the cast member into the Score so that it begins in frame 31 of sprite channel 4.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 371
Chapter 9 ✦ Creating an Interactive Presentation
3. Repeat Step 2, placing the cast members named factfinder nav text, Lander pilot nav text, and Quit nav text into the open sprite channel located after each navigation button sprite. 4. Adjust the length of the sprites so that they all end in frame 79. The Score now looks like the one shown in Figure 9-11.
Figure 9-11: The text sprites are located below the button sprite that they label; the lengths of the sprites have been adjusted.
5. In the Score window, Command+click (Ctrl+click) the four text sprites. Then apply the Background transparent ink to them from the Ink pop-up menu in the Score window. 6. Make sure that the sprites are still selected, and open the Sprite Inspector. Enter 125 for the X coordinate and 70 for the Y coordinate. All four text sprites are now next to the first navigation button. 7. In the Score, select the factfinder nav text sprite, and then open the Tweak window. Enter 125 into the horizontal offset field. 8. Repeat Step 7 with the other two text sprites, entering 250 and 375 into the horizontal offset field, respectively. 9. Select the four nav text sprites in the Score window, and apply the Typewriter Effect behavior, using the behavior pop-up menu. The Parameters dialog box appears (see Figure 9-12). This behavior enables you to control how the behavior is activated, how long it pauses before typing the next character, and what sound, if any, and the channel that sound plays in. For this use of the behavior, the only parameter you want to adjust is the time to wait parameter. Set it to 0 so that the text types on as fast as possible.
371
3486-6 ch09.f.qc
372
7/24/00
5:47 PM
Page 372
Part II ✦ Bringing It All Together
Figure 9-12: Set parameters for the Typewriter Effect behavior to control the way the text types on the screen. The Typewriter Effect behavior was originally located on the Library Palette in the Text category. We brought it into the Cast window for you to save time.
Note
10. Save the movie as explore4.dir, rewind the movie, and play it back. The text now types onto the screen. Caution
The Typewriter Effect behavior reads the text of the cast member to which it has been applied into memory. It then adds the text one character at a time, until the text string is completely typed. If you stop the movie before that text has completely typed on the screen, the text cast member will contain only the characters that have been typed in when the movie was stopped. This problem only occurs while you are creating the movie in Director, not when it’s played back as a projector or Shockwave movie. It’s a good idea to make a backup cast member of the text member to which you apply the behavior. If you stopped the movie before the text finished typing onto the screen, replace the cast members by using backup cast members of the four text labels located in the interface elements Cast window. You can find the backup cast members beginning in slot 101.
Building the Navigation Elements Carefully structuring the Score and Cast windows in combination with a good naming convention for the cast members saves hours of creation time. Defining sections of the Score that contain the various elements, such as buttons, headers, and content, speeds up the development and makes it much easier to update your movies months later. It doesn’t matter how you structure your movies. For instance, you might prefer to have the navigation elements begin in Sprite channel 50; the important thing is to use techniques that work for you and stick with them. Developing a consistent approach to the way you structure your movies is the main goal.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 373
Chapter 9 ✦ Creating an Interactive Presentation
Laying out the primary navigation elements Now that you have the opening animation sequence finished, it’s time to add the navigation elements to the rest of the movie. At this point, you want to start thinking about the structure of rest of the movie and the navigation behaviors you’re going to be applying to the buttons. The first step is to add markers to the movie that define where each section of content begins. Although it’s possible to add additional markers to the movie at any time, you are much better off if, early in the project, you add as many of the necessary markers as you can. This enables you to use the markers to jump easily to each section of the movie and add content. The other advantage is that most of the navigation behaviors that ship with Director generate a list of the markers in the movie as a parameter. When you apply the behavior, you can choose which marker you want the movie to jump to from a pop-menu contained within the behavior. Before beginning, review the Navigation flow chart shown in Figure 9-13. This helps you, first, to determine how many content screens to insert into each main section of the movie. Then you add markers that define the beginning of each section.
Explore Mars Navigation Flowchart Opening Animation
Vitural Tour
QTVR 1
QTVR 2
Mars Lander Game (external movie)
FactFinder
QTVR 3
Mars Facts Screen 1
Web Links
Mars Facts Screen 2 Mars Facts Screen 3 Figure 9-13: The flow chart helps you easily determine where to put the markers in your movie.
373
3486-6 ch09.f.qc
374
7/24/00
5:47 PM
Page 374
Part II ✦ Bringing It All Together
Adding the navigation markers With the exception of the Mars Pilot Game (which will be a separate Director movie), each box in the flow chart represents a point in the movie that you want to loop on a frame. Each of these frames in the movie enables users to view content or to make a decision about the next section of the movie that they want to view. Adding a marker that has the same name of each box in the flow chart makes it easy to define each section of the movie. Because you already know how to add sprites to the Stage, we saved you some time by placing the sprites on the Stage that are used for the second-level navigation of the movie. We also added a text cast member that appears at the end of the animation sequence that gives a brief explanation of the movie. On the CD-ROM
For the next exercise, you use the explore5.dir Director movie, which is on the CD-ROM in the EXERCISE:CH09 (EXERCISE\CH09) folder.
Adding the Markers 1. Open the explore5.dir movie in Director, and then make sure that the Score window is active. Note that a marker named intro text has been added to frame 82. This is where the movie pauses to let users select what section of the movie that they want to explore. 2. Click in the marker channel in frame 90, at the insertion point type tour. 3. Add the following markers to the indicated frames: frame 95 = olympus, frame 100 = viking, frame 105 = terraforming, frame 120 = fact, frame 125 = ppt1, frame 130 = ppt2, frame 135 = ppt3, frame 140 = HTML, frame 150 = quit. When you’ve finished this step, your Score looks like the one shown in Figure 9-14. Tip
When you add a new marker that’s close to an existing one, it’s often difficult to type in a name for the new marker. To avoid this problem, add a marker in a section of the Marker channel that has no other ones near it, type in the name for the marker, and then drag it to the frame of the movie where you want the marker to be located.
4. Save the movie as explore6.dir. Drag the Score window down so that the markers and the top of the Stage are both visible. 5. Press Command+left arrow (Ctrl+left arrow), and the playback head jumps to the next marker. If you press Command+right arrow (Ctrl+right arrow), the playback head jumps to the preceding marker. Note
You can also use the Markers window to navigate between markers, add new markers, and edit existing ones. Choose Window ➪ Markers, or press Command+Shift+M (Ctrl+Shift+M), to select the Markers window.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 375
Chapter 9 ✦ Creating an Interactive Presentation
Figure 9-14: The Score window with the markers added
The movie eventually will loop on each frame that has a marker. You could have put all of the markers next to each other in the Score, but this makes it difficult to see the names of the markers. Because the navigation jumps to each marker and then loops on the frame, it doesn’t matter where they are placed in the movie. So, you might as well spread them out so that’s it easier to read the labels. After you add the markers, you need to extend the button, label, and navigation bar sprites so that they appear in every frame on which the movie loops. When you perform this operation, you want to take into consideration the behaviors and other scripts that are going to be applied to the sprites. Sprites that have the same behavior applied to them throughout the movie, such as the navigation buttons, should be extended the entire length of the movie. This approach enables you to apply the behavior to the sprite once, and it also saves a lot of debugging if you have to modify the behavior, because it is applied to a single sprite instead of to several copies of the sprite.
Extending the Navigation Sprites and Color Coding the Score Window 1. In Director, open the explore6.dir movie that you saved in the preceding exercise. Make sure that the Score window is active. Scroll the Score window so that frames 30 to 80 are visible. 2. Command+click (Ctrl+click) the sprites that begin in frame 31 and are located in channels 1, 2, 3, 5, 7, and 9 to select them. With the sprites selected, enter 140 in the End Frame field located at the top of the Score window (see Figure 9-15). This extends the selected sprites to frame 140, which is the last frame in the movie that needs to have these sprites visible on the Stage.
375
3486-6 ch09.f.qc
376
7/24/00
5:47 PM
Page 376
Part II ✦ Bringing It All Together
Figure 9-15: Select sprites and type a frame number in the End Frame field to extend them.
3. Because the text label sprites have the Typewriter Effect behavior applied to them, you don’t want to extend them the entire length of the movie or else the effect keeps repeating itself. Select the text label sprite in channel 4, and then Option+drag (Alt+drag) a copy of the selected sprite next to the original one. Repeat this step for the text label sprites in channels 6, 8, and 10. 4. Command+click (Ctrl+click) duplicate versions of the text label sprites in channels 4, 6, 8, and 10, and then click the Behaviors pop-up menu (see Figure 9-16) in the Score window and choose the clear all behaviors option.
Figure 9-16: Add or delete behaviors to sprites from the Behaviors pop-up menu in the Score window.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 377
Chapter 9 ✦ Creating an Interactive Presentation
5. With the text label sprites still selected, extend them to frame 140, as you did in Step 2 with the other navigation sprites. 6. Apply a color to the sprites in channels 1 through 10 to make it easier to identify the navigation elements. Click in the sprite channel 1 label on the left side of the Score window. Then hold the Shift key down and click in the sprite channel 10 label, as shown in Figure 9-17. This selects all of the sprites in channels 1 through 10. Select a color from the swatches located in the lower left corner of the Score window.
Sprite channel labels Sprite channel color swatches Figure 9-17: Click in the sprite channel label to select all of the sprites in the channel.
7. Save the movie as explore7.dir. Color coding the sprite channels is just one more technique that you can use to organize your movies, enabling you to spend less time building and debugging the movie, giving you more time to focus on the creative aspects of your movies.
377
3486-6 ch09.f.qc
378
7/24/00
5:47 PM
Page 378
Part II ✦ Bringing It All Together
Adding the Navigation Behaviors Carefully structuring the way sprites are arranged in the Score makes the process of adding the behaviors and other scripts that add interactivity to your movie much easier. Another simple technique you can use to streamline building your movies is to drag all the behaviors found in the Library Palette into a Cast window before you begin applying them. When you drag a behavior from the Library Palette onto a sprite, Director places a copy of the behavior in the first available cast member slot of the current Cast window. Having behaviors spread throughout different Cast windows won’t affect the way the movie plays back; however, it does make it more difficult to find them again if you want to drag a behavior onto another sprite. Storing the behaviors in a separate Cast window makes it easier to locate them when you want to modify or apply the behaviors to other sprites that are added to the movie. The behaviors contained in the Library Palette that you’re going to use in the movie have already been added to the behavior Cast window. On the CD-ROM
For the following exercises, you can use the explore7.dir movie you saved in the preceding exercise, or you can use the explore7.dir movie on the CD-ROM in the EXERCISE:CH09 (EXERCISE\CH09) folder.
Adding the Loop on Frame Behavior 1. Open the explore7.dir movie in Director, making sure that the Score Window is open. 2. Click in frame 82 of the script channel under the marker named intro text. Choose the Hold on Current Frame behavior from the Behavior pop-up menu in the Score window. Note
You can find the Hold on Current Frame behavior in the Navigation category of the Library Palette.
3. Add this behavior to the other frames in the movie that contain markers (except the marker named start). Alternatively, you can copy the first behavior that you applied and paste in into the other frames. 4. Save the movie as explore8.dir. Next you’re going to add a behavior to the navbutton sprites on the main navigation bar that enables the buttons to become highlighted when the mouse rolls over them, display a down state and play a sound when clicked, and then jump to a specific section of the movie. The behavior you use is the MultiPurpose button behavior that you used in Chapter 7 to create multistate buttons. This behavior was custom built into Lingo to combine the features of several different behaviors found in Director’s Library Palette into a single behavior.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 379
Chapter 9 ✦ Creating an Interactive Presentation
Adding the Main Navigation Behaviors 1. Open the explore8.dir movie in Director, making sure that the Score window is visible. Open the Cast window and choose the behaviors cast. 2. Scroll the Score window so that the navbutton up sprite that begins in frame 31 of sprite channel 3 is visible. Tip
Remember that earlier in the movie, you added the sprite that serves as the label for the button in the sprite channel below the button.
3. Drag the MultiPurpose Button behavior from the behavior Cast window onto the navbutton up sprite that begins in frame 31 of channel 3. The Parameters dialog box for the behavior appears, as shown in Figure 9-18. 4. As long you haven’t moved any of the nav button cast members in the Cast Window the default cast members listed for the different states should be the correct ones. Make sure that the cast members used for the button states match the ones shown in Figure 9-18; if not, select the correct cast members from the pop-up menus for each parameter.
Figure 9-18: Make sure that cast members used for the button state parameters are the ones shown in this figure.
5. Select the “tour” marker from the Action pop-up menu. There is only one sound in the movie, so the button7 sound parameter is correct. If you want to use a cursor other than the finger for the rollover state, select a different cursor from the Use which cursor? pop-up menu.
379
3486-6 ch09.f.qc
380
7/24/00
5:47 PM
Page 380
Part II ✦ Bringing It All Together
6. Repeat Steps 3, 4, and 5 for the navbutton sprites in channels 5, 7, and 9. Select these parameters from the Action pop-up menu: channel 5 = “Fact”; channel 7 = nothing; channel 9 = nothing. 7. Save the movie as explore9.dir, and then rewind the movie and play it. Click the each of the buttons to make sure that they display the correct cast members for each state, that the sound plays, and that the first two buttons go to the correct markers. For the time being, the Lander Pilot and Quit buttons perform no action. Both of these buttons require a different type of behavior that you add in exercises later in this chapter.
Using the Jump to Marker behavior for the Quit button There are many situations that will arise in your movies in which you want the user to jump to another section of the movie and then return to the point in the movie from which the user came. In the movie that you’re building in this chapter, the Quit button on the main navigation bar needs to have this kind of functionality. When the user presses the Quit button, the user should have the option either to terminate the application or to change his or her mind and continue viewing the movie. If the user chooses to continue viewing the movie, it’s a good practice to return to the screen that the user was viewing previously. Director has several built-in behaviors that can be applied to a button that keep track of the frame where the movie was when the user pressed the button. The Jump to behaviors function like the Back and Next buttons in a Web browser, enabling a user to backtrack through the screens that they have viewed previously. These behaviors are very useful for a complex movie that has a large amount of interactive content. You can create a set of buttons that will automatically step the user through the sequence of screens that they chose to view in the movie or movies. You can also use these behaviors to create hyperlinks that branch to a deeper level of content contained in any movie, and then jump back to the original movie at the frame that the user was viewing previously. The behaviors that perform these operations are in the Navigation category of the Library Palette. They are called the Jump Forward, Jump Back, Jump to Marker, and Jump to Movie behaviors. In the next exercise, you add functionality to the Quit button on the main navigation bar of the explore9.dir movie. When the user clicks the Quit button, a screen asks whether to terminate the application or continue viewing the movie. Director’s built-in Jump to Marker behavior enables a user to jump to the Quit screen. If the user decides to continue viewing the movie instead of terminating it, the user can click a button that returns the user to the frame in the movie where the user clicked the Quit button. This behavior stores the frame number that the user was viewing when the user clicked the Quit button. If the user presses the Cancel button, the user returns to the frame in the movie that the user was viewing previously.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 381
Chapter 9 ✦ Creating an Interactive Presentation
A discussion about quitting Unless you are building a multimedia application that you’re sure will be viewed only by experienced computer users, you may want to consider not having the Quit button actually terminate the application. If the user accidentally clicks the Quit button, but hasn’t actually finished viewing the movie, the user will have to relaunch the application. In most cases, you want give the user a second chance to decide to actually terminate the application or continue viewing the movie. Although this technique requires the user to make an extra mouse click to quit the movie, it’s generally a good approach, especially if your application is being designed for less-experienced computer users. One method to prompt the user when the Quit button is clicked is to build an alert dialog box, which gives the option to terminate the movie or continue playing it. Creating these kinds of dialog boxes requires some pretty complex Lingo scripting in combination with Director’s MUI (Macromedia User Interface) Xtra. The MUI Xtra enables you to create dialog boxes that have the same look, feel, and functionality as the operating system’s dialog boxes. You can learn more about creating custom dialog boxes with the MUI Xtra in Chapter 23. If you’re not very comfortable with Lingo — or you don’t want to have a dialog box appear that looks like it’s part of the computer’s operating system — you can build an interim screen in the movie that asks the user if he or she wants to terminate the application or continue viewing the movie. The advantage to this approach is that it enables you to use the same look and feel as the rest of the movie. This interim screen is also a good place to include the credits for your movie.
Adding the Jump to Marker Behavior 1. In Director, open the explore9.dir movie that you saved in the preceding exercise, making sure the Score window is open. Then select the behaviors Cast window. 2. Locate the Jump to Marker behavior and drag it onto the navbutton up sprite in channel 9. Note
The Jump to Marker behavior is located on the Library Palette in the Navigation category.
3. In the Parameters dialog box, choose the Quit marker from the On mouseUp, jump to marker menu, set the Jump Mode to Play and Return, and make sure that the Remember Current Marker for Back button? box is checked, as shown in Figure 9-19. Figure 9-19: The parameters are correctly set for the behavior.
381
3486-6 ch09.f.qc
382
7/24/00
5:47 PM
Page 382
Part II ✦ Bringing It All Together
4. With the Score window active, press the Tab key. This action advances the movie to the last frame that has a sprite in it (the Quit screen in this case). Drag the Score window so that the two buttons labeled Cancel and OK are visible on the Stage. 5. Select the button labeled Cancel, locate the MultiPurpose Button behavior in the behaviors Cast window and drag it onto the sprite. Select the following cast members for the button state parameters: Up state = GlassButton up; Down state = GlassButton down; Roll state = GlassButton roll; Inert state = GlassButton up. The sound parameter should be correct, because there is only one sound in the movie. You want to make sure that the nothing is chosen for the action parameter. Use the default Finger cursor if that is the one that you’re using for the other buttons. 6. Drag the Jump Back button behavior from the behavior Cast window onto the sprite. This behavior intercepts a message sent from the Jump to Marker behavior applied to the Quit button that keeps track of the frame number the movie was in when a button that contains a Jump to behavior is clicked. Tip
Director’s built-in behaviors contain detailed descriptions of the functions that the behavior will perform. To see this information, double-click the behavior in the Cast window; this activates the Behavior Inspector. The information about the behavior is in the Description pane of the Behavior window. If you click the Script button in the Behavior Inspector, you will find that the Lingo script usually contains commented information that goes into greater detail about the behavior’s functionality.
7. Save the movie as explore10.dir. Rewind the movie and play it. Click the Quit button on the main navigation bar. When the Quit screen appears, click the Cancel button. Try this from several different frames of the movie and note that you are brought back to the exact frame in the movie that you were in when you clicked the Quit button. The Jump to Marker and Jump Back button behaviors are designed to work together. If you apply the Jump to Marker behavior to a button, you have to apply the Jump Back button behavior to the button that is used to jump back to the previous frame of the movie that was being viewed. Note
You can have this same functionality if you want to jump between several movies by using the Jump to Movie behavior in combination with the Jump Back button behavior. You learn how to use this technique later in this chapter.
Terminating the application Director has two Lingo commands that you can use to terminate the application: Quit and Halt. The Quit command stops the movie and terminates the Director application. This can be very frustrating while you are building the movie, because you have to relaunch Director each time you click the button that has the Quit command applied to it.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 383
Chapter 9 ✦ Creating an Interactive Presentation
Instead of the Quit command, use Lingo’s Halt command. The Halt command functions similarly to the Quit command by terminating the application when the movie is played as a projector, but it does not terminate the Director application while you’re building the movie. Now you need to add a behavior to the OK button located on the Quit screen that terminates the application. To accomplish this, you apply the MultiPurpose button behavior to the OK button, and then you build a custom mouseUp event that uses Lingo’s Halt command to terminate the application.
Adding the Halt Command to the OK Button 1. Open the explore10.dir movie that you saved in the preceding exercise, and make sure that the Score window is active. 2. Press the Tab key to advance to the last frame in the movie, and drag the Score window so that the button labeled OK is visible on the Stage. Click the Behavior icon on the Toolbar to activate the Behavior Inspector. 3. Click the Behavior pop-up button and choose the MultiPurpose button behavior from the list. In the Parameters window, choose the same cast members for the buttons states that you applied to the Cancel button in the preceding exercise, and then click OK to return to the Behavior Inspector. Figure 9-20 shows the correct parameter settings that should be applied to the behavior.
Figure 9-20: Choose the same parameters as shown in this figure.
4. Make sure that the behaviors Cast window is open, and then click the Behavior Inspector to make it active. If the window is blank, reselect the OK button sprite. 5. Click the Behavior pop-up button, and choose the New Behavior option. A dialog box appears, prompting you to name the behavior; name it QuitMovie.
383
3486-6 ch09.f.qc
384
7/24/00
5:47 PM
Page 384
Part II ✦ Bringing It All Together
6. Make sure that the Events and Actions pane is open in the Behavior Inspector. Click the Event button, and choose the mouseUp event. Then click the Action button and choose Navigation ➪ Exit. Figure 9-21 shows how the behavior should appear in the Behavior Inspector window.
Figure 9-21: The Event and Action have been added to the QuitMovie behavior. Note
The Exit option uses the Lingo Halt command. Don’t confuse this with the Lingo command called exit that is used to exit a handler. If you open the script for this behavior, you will see that Director is using the Halt command.
7. Save the movie. Rewind the movie and play it. Click the Quit button and then click the OK button. The movie should stop playing and return you to Director’s main window. When you build a new behavior with the Behavior Inspector, the cast member that’s created is stored in the first available slot of the active Cast window. Having the behaviors Cast window active when you built the behavior ensured that the cast member would be stored in the same Cast window as the other behaviors used in the movie.
Building the QuickTime VR Tour You use Apple’s QuickTime VR (QTVR) technology to create photorealistic virtual environments that are platform independent. This exciting new technology is beginning to see widespread use both on the Web and in stand-alone applications such as games. There’s even a QTVR that was taken on the planet Mars (definitely one of our favorite QTVR movies).
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 385
Chapter 9 ✦ Creating an Interactive Presentation
There are three types of QuickTime VR media: Panoramas, Objects, and Scenes. Each media type and their uses are as follows: ✦ A QTVR panorama enables you to view a scene — usually a landscape or a room in a house or building — from a variety of angles. Most panoramas are created using a full 360-degree view, giving the illusion that you’re standing in the center of the scene. View a panorama by dragging the mouse in the direction that you want to view. When you move the mouse to a different quadrant of the window, the cursor changes to indicate the direction that you are moving in the scene. ✦ A QTVR object enables you to view a three-dimensional object, such as a car or a computer monitor, from a variety of angles. Rotate an object by clicking the mouse button on the object and dragging it in the direction that you want to view it. ✦ A QTVR scene is usually a collection of panoramas, objects, and other media, such as Web links, and static images, such as maps, that are combined into one movie. Each of these individual components is called a node. A QTVR scene contains hot spots — areas that link the nodes together. When the mouse passes over one of these hot spots, it changes to a finger, indicating that you can perform some action in the panorama. For example, you could have a panorama of a living room, and when the mouse passes over the door to the kitchen you can have a hot spot that enables the user to click on the door and view another panorama of the kitchen. Director fully supports the three QuickTime media formats. There are several Lingo commands that you can use to control various functions of the QTVR movies, such as the playback quality, size, and zoom settings. CrossReference
You learn more about Director’s QTVR Lingo commands in Chapter 19, where you’ll use Lingo to add functionality to a multinode QTVR scene.
Although you have a quite a bit of control over the way QuickTime VR files are used in your movies, Director does not have the capability to create the actual QTVR panoramas, objects, and scenes. You need to create them in another application, such as Apple’s QuickTime VR Authoring Tool, and then import them into Director. For users to view QTVR movies, they need to have QuickTime installed on their systems. If you’re distributing your movies on CD-ROM, you should look into licensing QuickTime from Apple so that you can include a QuickTime installer with the your interactive applications. Another approach is to create a Lingo script that detects whether QuickTime is installed on the user’s system. If it’s missing, you can have an alert box appear, asking users if they want to download it from the Web. Director then can launch the user’s browser to download the QuickTime extensions. This technique works for projectors as well as for Shockwave movies, as long as the user has a Web browser and a connection to the Internet.
385
3486-6 ch09.f.qc
386
7/24/00
5:47 PM
Page 386
Part II ✦ Bringing It All Together
Remember that large QTVR movies (especially complex scenes) can be very resource intensive. If your Director movies will be viewed on slower computers, you may want to avoid using complex QTVR scenes in your applications. You can learn more about Apple’s QuickTime VR technology, and see several QTVR examples at their Web site at http://www.apple.com/quicktime
Tip
Importing QuickTime VR movies into Director There’s no big mystery to importing QuickTime VR movies into Director. QTVR movies appear to Director as a QuickTime movie, and you import them the same way as any other digital video file. Remember that QTVR movies are linked files, so the QTVR movies should be in the same folder as the Director movie. You also want to make sure that you include the original QTVR files if you are distributing your Director movies as projectors. In the next exercise, you import and place three QTVR files — olympus.mov, viking. mov, and mohole.mov — into the explore11.dir movie, which is on the CD-ROM. This movie has all the elements in it that you added in the previous exercises, except that we added the navigation behaviors to the second-level navigation elements. On the CD-ROM
You need to have QuickTime 3.0 or greater installed on your system for the next exercise. The QuickTime installer for both the Macintosh and Windows is on the CD-ROM in the GOODIES:QUICKTIME (GOODIES\QUICKTIME) folder. The explore11.dir and three QTVR files olympus.mov, viking.mov, and mohole.mov are on the CD-ROM in the EXERCISE:CH09 (EXERCISE\CH09) folder. You may want to copy these files to a folder on your hard drive before beginning the following exercise.
Adding the QTVR Movies 1. Open the explore11.dir movie in Director. Press Command+3 (Ctrl+3) to display the internal Cast window. 2. Choose File ➪ Import or press Command+R (Ctrl+R). When the Import dialog box appears, select the olympus.mov, viking.mov, and mohole.mov files, and then click OK to import the files and return to Director’s main window. 3. In the Score window, click the Markers pop-up menu and choose the Olympus marker. Click Sprite channel 24, and drag the Olympus cast member into the core window or onto the Stage. 4. Open the Property Inspector and click the Sprite tab, make sure that the QTVR sprite is still selected, and position the sprite by entering 375 into the X field and 300 into the Y field of the Property Inspector window (see Figure 9-22).
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 387
Chapter 9 ✦ Creating an Interactive Presentation
Tip
Pressing the Tab key advances you to the next field in the Sprite Inspector. This technique works for most of Director’s dialog boxes and tool windows that have multiple text fields.
Figure 9-22: Use the Property Inspector to position a sprite on the Stage.
5. Repeat Steps 3 and 4 for the viking and mohole QTVR cast members. Place the viking QTVR in the frame labeled viking and the mohole QTVR in the frame labeled terraforming. 6. Save the movie as explore12.dir, and then select the tour marker from the marker window and play the movie. Press the Olympus Mons button, and then drag the mouse on the VR. Note
Press the Shift key to zoom in on the VR. Press the Control (Alt) key to zoom out.
Displaying the controller in QTVR movies You can set the properties of a QTVR movie to display a controller in the same way that you can with other digital video movies in Director by choosing the display controller option in the QuickTime Cast Member tab of the Property Inspector. You might want to display the controller if you want the user to be able to zoom in and out or view the hot spots. Although it’s possible to use a key command to zoom, it might be easier for the user to use the zoom tools found on the controller.
387
3486-6 ch09.f.qc
388
7/24/00
5:47 PM
Page 388
Part II ✦ Bringing It All Together
Note
You have to choose the Direct to Stage property to display a controller in a QTVR or digital video movie.
Another good reason to display the controller is to give users a short description of parts of the scene, or to inform them where a hot spot will take them if they click on it. It’s possible to create QTVR movies that can display a text description of a hot spot in the controller bar. When you viewed the QTVR panoramas in the preceding exercise, you may have noticed that the cursor frequently changed to a finger. These are hot spots that we built into the panoramas that contain text descriptions of different elements in the scene. In the next exercise, you set the properties of the QTVR movies to display the controller, enabling users to view the text descriptions. You also set several properties that enable Director to preload the panorama into memory and play the QTVR movie at maximum speed.
Setting the QTVR Properties 1. Make sure that the explore12.dir movie that you saved in the preceding exercise is open in Director. 2. Open the Cast window, and select one of the QTVR cast members. With the cast member selected, click the Properties button in the Cast window. When the Property Inspector appears, click the QuickTime tab. 3. Click the Show Controller checkbox, set the Video property to Play Every Frame (No Sound), set the Rate property to maximum, and click the Enable Preload option. These settings optimize the playback of the QTVR panorama. Note
When the Enable Preload option is selected, Director loads the entire QTVR movie (or as much as of the movie as will fit into the available memory) when the movie starts playing so that there won’t be a delay when the QTVR movie is displayed.
4. Repeat Step 3 for the other two QTVR movies. 5. Save the movie as explore13.dir, rewind the movie, and play it. Click the Virtual Tour button, and then select one of the QTVR panoramas. When you drag the mouse over a hot spot, note that a brief description of the hot spot appears in the controller. Tip
Click the Arrow button in the controller to view the hot spots that are contained in a QTVR movie.
QuickTime VR can literally add another dimension to your Director movies. Use Lingo to add other features to your QTVR movies, such as custom control buttons, to have the panoramas automatically zoom in or out, and to control the playback quality. It would even be possible to have the text that was displayed in the controller of the panoramas be displayed in a Director text cast member.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 389
Chapter 9 ✦ Creating an Interactive Presentation
Adding Content from Other Sources If you’re an experienced Director user, you’ve probably had to recreate from scratch a PowerPoint presentation to use in a movie, because it wasn’t possible to import PowerPoint files. Have you ever tired to create hyperlinks for a movie? In earlier versions of Director, it required a good working knowledge of Lingo to create them. Director has solved most of these problems by enabling you to import PowerPoint presentations and HTML text into your movies. You may want to keep this a secret, though, because the world is full of poorly designed HTML pages and PowerPoint presentations that your client will want to use in a Director movie. All kidding aside, these features can really save a lot of movie-building time. The key to effectively using these types of media in Director is to try to control the initial design so that they fit seamlessly into your movies. Tip
If you are planning to use PowerPoint or HTML text content in a Director movie, design a template that fits the look and feel of the movie and have whoever is creating the content use these templates. This will save you from a lot of headaches later.
Importing PowerPoint presentations Importing a PowerPoint presentation into Director is a somewhat convoluted process. When you import a PowerPoint file using the Import PowerPoint File Xtra, Director takes all the individual elements (text, graphics, transitions, and so on) of the original PowerPoint file and converts them to individual cast members. Director then rebuilds the presentation in the Score window, using the converted cast members, and automatically applies a Wait For Mouse or Key Click Tempo setting for each slide. You define the way that Director will assemble the elements in the Score by means of the PowerPoint Import Options dialog box that appears after you have chosen a file to open (see Figure 9-23). The PowerPoint Import Options dialog box enables you to the set these options: ✦ Slide Spacing determines the number of empty frames in the Score between slides. ✦ Minimum Slide Duration determines the number of frames in the Score that a slide will use if it has no build or animation effects applied to it. ✦ If the presentation contains static build effects (such as text builds), Director will create a new slide for each effect. Item Spacing determines the number of empty frames between build slides.
389
3486-6 ch09.f.qc
390
7/24/00
5:47 PM
Page 390
Part II ✦ Bringing It All Together
✦ Fly Transition Item Spacing determines the number of frames in the Score that will be used to recreate any animated transition effects in a slide. Unfortunately, this setting is applied globally to all of the transitions in the file; however, you can adjust them individually in the Score window after the file has been converted.
Figure 9-23: Use the PowerPoint Import Options to set frame duration for the slides and effects that Director will use to create the presentation in the Score window.
When Director imports a PowerPoint file, it creates a copy of the presentation file, which means that you can enhance the Director movie without affecting the original PowerPoint document. Use Lingo to add more interactivity to the presentation, such as enabling users to select which slides they want to view from a pop-up menu. You can also use any of the features in Director to add sophisticated interactivity, such as synchronized audio and animation. In most cases, Director does a very good job of retaining the original look and feel of a PowerPoint presentation. Nevertheless, there are several caveats of which you need to be aware before importing a PowerPoint file: ✦ Director can import only version 4.0 PowerPoint files. If you are using a newer version of PowerPoint, you need to save the presentation as a PowerPoint 4.0 file. ✦ You can import a PowerPoint presentation into a new Director movie only. If you want to add a PowerPoint file to an existing movie, you need to create a new movie, import the file, and then copy and paste the Score data from the movie into the movie to which you are adding the presentation. ✦ When Director encounters a feature in a PowerPoint presentation that it doesn’t support, such as certain transitions or fonts, it substitutes the closest matching feature. Both the user manual and Director’s built-in help engine contain a detailed description of PowerPoint’s features and how they are converted in Director. To view this information in Director’s built-in help engine, type PowerPoint in the Find section, and then choose the Comparison of PowerPoint and Director Features category. ✦ You may run out of memory if you’re importing a large PowerPoint file that contains several OLE objects, such as charts and graphs, or if the file contains many large bitmap images. If this is the case, you may want to divide the PowerPoint file into several smaller ones and import them individually.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 391
Chapter 9 ✦ Creating an Interactive Presentation
The movie that you’ve been building in this chapter uses a simple PowerPoint presentation in the FactFinder section. In the next exercise, you import a PowerPoint presentation that we built for you into a new Director movie. Because you cannot import PowerPoint files directly into an existing movie, you will copy and paste the Score data into the explore13.dir movie that you saved in the preceding exercise. On the CD-ROM
You use a PowerPoint file named facts.ppt for this exercise, which is on the CD-ROM in the EXERCISE:CH09 (EXERCISE\CH09) folder.
Importing a PowerPoint File 1. Open Director and create a new movie. 2. Choose Xtras ➪ Import PowerPoint File. A dialog box appears, prompting you to locate a PowerPoint file. Select the facts.ppt file and click Open. 3. The PowerPoint Import Options dialog box appears, as shown in Figure 9-23. The only option you need to adjust is the Slide Spacing. Enter 1 in the Slide Spacing field. Because you are using the default Item Spacing of 4 — forcing each slide to span 4 frames of the movie — you are left with one empty frame between slides, so each slide begins 5 frames from the previous one. This makes it easier to paste the slides into the explore.dir movie, because the markers that you placed in the movie that will contain the slides are spaced 5 frames apart. Click Import, and the file is imported into Director and the elements appear on the Stage and in the Score window, as shown in Figure 9-24.
Figure 9-24: The converted PowerPoint file as it appears in Director.
391
3486-6 ch09.f.qc
392
7/24/00
5:47 PM
Page 392
Part II ✦ Bringing It All Together
Note
After the file is imported, you will be alerted to reset the Stage size of your movie to match the size of the PowerPoint presentation. Because you will be copying the content into a new movie that is a different size, you can ignore this alert.
4. Save the movie as facts.dir. Rewind the movie and play it. Note that you can click the mouse or press any key to advance to the next slide. Take a few moments to explore how the movie is constructed by examining the Score and Cast windows. Now that you have the PowerPoint file converted to a Director movie, you need to copy the contents of the facts.dir movie into the explore13.dir movie that you saved to your hard drive at the end of the QTVR exercise earlier in this chapter. The easiest way to accomplish this is to copy the Score data from the facts.dir movie, and then paste the data into the explore13.dir movie. When you paste the Score data from one movie into the destination movie, Director places all of the cast members that the sprites in the Score window are referencing into the active Cast window. You may have noticed earlier that Director created 50 cast members when it converted the facts.ppt PowerPoint file. If you have the Internal or one of the other Cast windows active when you paste the Score data into the explore13.dir movie, the active Cast window will become quite a mess. To avoid this problem, you create a new Cast window, called PowerPoint, that will be active when you paste the score data from the facts.dir movie. This will make it much easier to identify the cast members that are used for the PowerPoint slides, because they will be contained in their own Cast window.
Inserting the PowerPoint Slides into an Existing Movie 1. With the facts.dir movie open in Director, make the Score window active so that all of the sprites that make up the three slides are visible. 2. Select all of the sprites, except the one called Shape item 11 in sprite channel 1, by clicking on the first sprite in channel 2, and then holding the Shift key down and clicking in frame 18 of sprite channel 23 (see Figure 9-25). Note
The sprite in channel 1 is a black rectangle that’s used as a background for the slides. Because the movie into which you’re going to paste these sprites already has a black background, this sprite is redundant and isn’t needed.
3. Press Command+ C (Ctrl+C) to copy the sprites to the Clipboard. 4. Open the explore13.dir movie that you saved earlier in the chapter. Make the Cast window active. Click the Choose Cast button, and select the New Cast option. When the New Cast dialog box appears, name the Cast PowerPoint and make sure that the Internal Radio button is selected. 5. Close any other open Cast windows to make sure that the PowerPoint Cast window is active.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 393
Chapter 9 ✦ Creating an Interactive Presentation
Figure 9-25: All of the sprites that you want to paste into the destination movie are selected.
6. In the Score window, click sprite channel 24 in the frame that contains the ppt1 marker. Choose Edit ➪ Paste Sprites. Director pastes the sprites from the Clipboard into the Score beginning from the selected point in the Score window. The cast members are pasted into the PowerPoint Cast window, as shown in Figure 9-26. Tip
You might want to assign a color to these sprites to make it easier to identify them later. Make sure that the sprites are still selected in the Score window, and click on one of the color swatches located at the bottom-left corner of the Score window.
7. Save the movie as explore14.dir. Now you need to reposition all of the sprites so that they are located in the proper position on the Stage. 8. Make sure that all of the sprites that you pasted into the movie are still selected. In the Score window, put the playback head in the frame that’s labeled with the ppt3 marker, and then drag the Score window so that the Stage is visible. Caution
If you try to move the sprites on the Stage by dragging them, chances are that you’ll only choose one sprite instead of all of them. The safest way to move the sprites so that they all stay selected is to use the Tweak window.
393
3486-6 ch09.f.qc
394
7/24/00
5:47 PM
Page 394
Part II ✦ Bringing It All Together
Figure 9-26: The sprites are pasted into the destination movie, beginning at the selected frame.
9. Open the Tweak window by pressing Command+Shift+K (Ctrl+Shift+K). Enter 125 into the Horizontal Offset field and 100 into the Vertical offset field to position the sprites close to the final position that you want. Fine-tune the position of the sprites by entering new numbers into the Horizontal and Vertical Offset fields until you are satisfied with the final position. The Stage should look similar to the one shown in Figure 9-27. Caution
Tip
If you want to tweak a sprite in one direction only, make sure that you enter 0 in the other Offset field.
After you are satisfied with the position of the sprites, press Command+L (Ctrl+L) to lock them. This will prevent you from accidentally selecting and moving one of the sprites.
10. Save the movie, and then rewind it and play it. Click the Factfinder button, and then click the Mars Facts button. Click the Next and Prev button to view all three screens to make sure they are positioned correctly.
3486-6 ch09.f.qc
7/24/00
5:47 PM
Page 395
Chapter 9 ✦ Creating an Interactive Presentation
Figure 9-27: Use the Tweak window to adjust the position of the sprites so that they look similar to the figure.
Adding a PowerPoint file to an existing Director movie is a bit cumbersome. Carefully structuring the way that Director creates the sprites in the Score and creating a separate Cast window that will contain the cast members that are pasted into the destination movie will save you considerable time and headaches. Locking the sprites after they have been placed in your movies prevents you from accidentally bumping a sprite out of position.
Using HTML text in a movie In today’s world, almost every multimedia application has some type of Internet component to it. These components cover a wide range of possibilities, ranging from a simple link to a Web site to a multiuser CD-ROM game that connects to a server and enables you to compete online against other people from all over the world. It’s possible to create applications with Director that cover both ends of this spectrum. In this section, you learn the basics of Director’s Internet capabilities by importing an HTML document that contains hypertext links to several different Web sites. Then you apply a built-in behavior to the HTML text that will launch a Web browser and display the chosen Web site when a user clicks a hyperlink. When an HTML document is imported into a movie, it becomes a text cast member, giving you the same formatting control and options that you have with any other text cast member. Director recognizes most of the standard HTML tags and parameters, and approximates this formatting in the text cast member.
395
3486-6 ch09.f.qc
396
7/24/00
5:47 PM
Page 396
Part II ✦ Bringing It All Together
Caution
Director does not recognize the <APPLET>,