DIRECTOR MX ® 2004 Using Director
Trademarks ActiveEdit, ActiveTest, Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware, Authorware Star, Backstage, Blue Sky Software, Blue Sky, Breeze, Bright Tiger, Clustercats, ColdFusion, Contents Tab Composer, Contribute, Design In Motion, Director, Dream Templates, Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, FlashHelp, Flash Lite, FlashPaper, Flex, Flex Builder, Fontographer, FreeHand, Generator, Help To Source, Ho
CONTENTS CHAPTER 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 About Director . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 What’s new in Director MX 2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Guide to instructional media. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 CHAPTER 2: Score, Stage, and Cast . . . . .
CHAPTER 3: Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Creating sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Setting sprite general preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Selecting sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Naming sprites . . . . . . . . . .
Using bitmap filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using onion skinning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Paste as Pict option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting bitmap cast member properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting PICT cast member properties . . . . . . . . . . . . . . . . . . . .
CHAPTER 9: Using Flash, Flash Components, and Other Interactive Media Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Using Flash Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Adding a Flash content cast member . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Editing a Flash cast member . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 11: Using Digital Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 About digital video formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the video windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Playing digital video direct-to-Stage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlling digital video in the Score . . . . . . . . . . . . . . . . . . .
CHAPTER 14: 3D Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 What you need to know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 About 3D in Director MX 2004 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 The 3D Xtra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Using the Shockwave 3D window . . . . . . . . . . . . . . . .
CHAPTER 17: Controlling the 3D World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 3D Lingo or JavaScript syntax events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Vector math. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 23: Packaging Movies for Distribution . . . . . . . . . . . . . . . . . . . . . . . 447 About distributing movies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Shockwave browser compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 Previewing a movie in a browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 About Xtra extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 1 Introduction Welcome to Macromedia Director MX 2004. With Director, you can develop high-performance multimedia content and applications for CDs, DVDs, kiosks, and the Internet. This guide, Using Director, includes comprehensive descriptions and detailed step-by-step instructions that explain how to use all of the features in Director.
Users view your completed Director movies in one of the following ways: • In a projector, which plays on your user’s computer as a stand-alone application. • In the Macromedia Shockwave Player format, which plays in Shockwave-enabled web browsers. Millions of web users already have the Shockwave Player on their computers, browsers, or system software. Others have downloaded Shockwave Player, which is free, from the Macromedia website at www.macromedia.com/shockwave/download/.
Integrating with Macromedia server technologies You can now choose to integrate Director with Macromedia server technologies, such as Macromedia ColdFusion MX 6.1 and Macromedia Flash Communication Server MX. For multi-user games, distance learning content, and other server-controlled content, this link between your Director content and IT infrastructure extends your interactivity options.
To access context-sensitive help, do one of the following: • If you are working in a window, display the Options menu for that window and select Help. • If you are working in a dialog box, click the Help button. Director Help opens and displays a topic that relates to the window or dialog box that you are using.
Director Scripting Reference This manual is available in printable PDF format from the Director Documentation Center at www.macromedia.com/go/director_docs. It provides a complete reference of the Director application programming interfaces (APIs), including both Lingo and JavaScript syntax. Information in the manual is also available in the online Director Help.
Chapter 1: Introduction
CHAPTER 2 Score, Stage, and Cast If you are new to Macromedia Director MX 2004, see the Getting Started topics in the Director Help Panel to become familiar with the Director workspace and features. (In Macromedia Director MX 2004, select Help > Director Help to view the Getting Started topics.
To change Tool palette views: 1 If the Tool palette is not already available, select Window > Tool Palette. The default Tool palette appears. 2 Click on the Tool palette view menu and select the view you want: classic, flashcomponent, or default. The Tool palette changes to display the tools available for each view. In Windows, you can also dock the Tool palette to the docking channels contained by the application window. (There are no docking channels on the Macintosh.
To create and set guide properties: 1 With the Property inspector open, click the Guides tab. The top half of the tab contains settings for Guides. 2 Click the Guide Color box to select a different color. 3 Select the options you want to make the guides visible, lock them, or to make the sprites snap 4 5 6 7 to the guides. To add a guide, move the cursor over the new horizontal or vertical guide, and then drag the guide to the Stage.
Changing Score settings To control the appearance of the Score and the information that appears in numbered sprite channels, you set preferences for the Score. By doing so, you can display a script preview and cast member information. To change Score settings: 1 Select Edit > Preferences > Score. Note: If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences.
Selecting and editing frames in the Score You can select a range of frames in the Score and then copy, delete, or paste all the contents of the selected frames. To move, copy, or delete all the contents of a range of frames: 1 Double-click in the frame channel to select frames. Double-click here to select all sprites in a frame, including markers, special effects, and sounds. Double-click and drag to select a range of frames.
To add new frames: 1 Select a frame in the Score. 2 Select Insert > Frames. 3 Enter the number of frames to insert. The new frames appear to the right of the selected frame. Sprites in the frames you select are extended or tweened. For more information about tweening, see Chapter 4, “Animation,” on page 83. About Cast Members Cast members are the media and other assets in your movie.
Casts can be internal—stored inside the movie file and exclusive to that movie—or external— stored outside the movie file and available for sharing with other movies. When you create a new movie, an empty internal cast is created automatically, and when you open the Cast window it is in the default List view. For more information about Cast window views, see “Switching from one Cast window view to another” on page 26.
To create a new cast: 1 Do one of the following: ■ ■ ■ Select File > New > Cast. Select Modify > Movie > Casts to open the Movie Casts dialog box, and click the New button. In the Cast window, click the Cast button and select New Cast from the pop-up menu. (See “Using Cast window controls” on page 29.) Cast button 2 In the New Cast dialog box, type a name for the new cast. 3 Specify how to store the cast: Internal stores the cast within the movie file.
To create a new cast member from the Insert menu: 1 Open the Cast window for the cast member you are creating. To place a cast member in a specific position in the Cast window, select the position in Thumbnail view. For more information, see “Using Cast Thumbnail view” on page 33. Otherwise, Director places the new cast member in the first empty position or after the current selection in the Cast window. 2 Select Insert > Media Element, and then select the type of cast member to create.
To create a cast member using the Script window: 1 Open the Script window by selecting Window > Script. 2 Click the New Cast Member button to create a script cast member. To create a cast member on the Stage: 1 Open the Tool palette, if it is not already open, by selecting Window > Tool Palette. 2 Using the tools in the Tool palette, create content directly on the Stage. Each object you create automatically becomes a cast member.
Working with Cast panel groups Each Cast panel and panel group has an Options menu located in its upper right corner. The Options menu contains items for grouping, closing, and renaming panels. To use a Cast panel Options menu: • Click the Options menu control in the upper right of the panel, and select the desired menu item. Help launches the page in the help system that is relevant to the current panel.
To rearrange the order of tabs within a Cast panel group: 1 Select a tab within the Cast panel group. 2 Select Group [Panel Name] With from the panel group’s Options menu, then choose the name of the Cast panel group that contains the selected panel. The tab is moved to the last (rightmost) position in the panel group. Note: Save your panel layout if you want to restore your Cast panel configuration the next time you open your file.
Using Cast window controls The controls along the top of the Cast window are the same in both the List and Thumbnail views. You use the controls to change the cast that appears in the Cast window, the cast member selection, or the name of a cast member. You can also use them to move cast members and to open a cast member’s Script window or the Property inspector.
To view cast member properties: 1 Select a cast member. 2 Do one of the following: ■ ■ ■ Click the Cast Member Properties button. Right-click (Windows) or Control-click (Macintosh), and select Cast Member Properties from the context menu. Select Window > Property Inspector. The Property inspector displays only those properties associated with the selected cast member. For more information, see “Viewing and setting cast member properties” on page 39.
Naming cast members To avoid problems in Lingo or JavaScript syntax when referring to cast members, you should name them and then refer to them by name. Naming cast members doesn’t affect Director performance. The name stays the same even if the cast member number changes. Avoid duplicating cast member names. If more than one cast member has the same name, Lingo or JavaScript syntax uses the cast member with the lowest number in the cast.
Four additional columns are available in the Cast Window Preferences dialog box. For more information, see “Setting Cast window preferences” on page 36. The additional columns that you can display are described in the following table: Column Title Column Information Size The size in bytes, kilobytes, or megabytes Created The date and time the cast member was created Modified By Who modified the cast member. This value comes from the user login name (Windows) or the Sharing setup name (Macintosh).
Using Cast Thumbnail view As the name suggests, the Cast Thumbnail view shows a very small (thumbnail) version of the cast member, along with an icon that represents the cast member media type, as shown in the following table: Icon Cast member type Icon Cast member type Animated GIF Behavior Bitmap Button Check box Custom cursor Digital video DVD Field Film loop Flash component Flash movie Font Linked bitmap (all linked cast member icons are changed in the same way) Movie script OLE Pale
To turn off or on the display of cast member icons in Thumbnail view and change the Cast window display: • Select Edit > Preferences > Cast. For more information, see “Setting Cast window preferences” on page 36. Note: If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences. Creating a custom cast member thumbnail Note: For most cast members, Director displays a scaled version as the thumbnail unless you define a custom thumbnail.
Moving cast members within the Cast window To move a cast member to a new position within the Cast window, you can use Thumbnail view to see the representation of the cast member’s position. Note: When you move a cast member to a new position, Director assigns it a new number and updates all references to the cast member in the Score, but it doesn’t automatically update references to cast member numbers in Lingo or JavaScript syntax.
To sort the cast using the Modify menu: 1 With the Cast window active, select the cast members to sort or select Edit > Select All. 2 Select Modify > Sort. 3 In the Sort Cast Members dialog box, select one of the following sorting methods: Usage in Score places selected cast members that are used in the Score at the beginning of the selection. Media Type groups all cast members according to their media type. Name groups the selection alphabetically by cast member name.
3 To set the Cast window to display in either List or Thumbnail view, select the appropriate Cast View option. 4 If you want your preferences to apply to all Cast windows, select Apply to All Casts. 5 To select the columns that appear in Cast List view, select the desired List Columns options. See “Using Cast List view” on page 31. 6 To specify the maximum number of cast members to appear in the Cast window, select a value from the Thumbnails Visible pop-up menu.
Changing Cast properties You use the Property inspector to change the name of a Cast and to define how its cast members are loaded into memory. To change Cast window properties: 1 With the Cast window as the active window, open the Property inspector and click the Cast tab. 2 To change the name of the current cast, enter the new name in the Name text box.
Viewing and setting cast member properties You can display and set properties for individual cast members, or for multiple cast members at once, even if the cast members are different types. In both cases, you use the Property inspector. You can also set cast member properties by using Lingo or JavaScript syntax (see “Setting cast member properties using Lingo or JavaScript syntax” on page 49). To view and set cast member properties: 1 Select one or more cast members.
For information about specific cast member properties, see the following topics: • • • • • • • • • • • • • • • • • • • “Using animated GIFs” on page 101” “Embedding fonts in movies” on page 164 “Using Flash Content” on page 181 “Setting bitmap cast member properties” on page 128 “Setting vector shape properties” on page 142 “Synchronizing media” on page 240 “Setting film loop properties” on page 95 “Setting palette cast member properties” on page 155 “Setting PICT cast member properties” on page 128 “To s
To find cast members: 1 Select Edit > Find > Cast Member. 2 In the Find Cast Member dialog box, select a Cast window to search from the Cast pop-up menu. To search every cast in the movie, select All Casts. 3 Select a search option: ■ Select Name, and enter search text in the text box. For example, to search for a group of related cast members that share a common element in their names, you might enter the word Bird to search for cast members named Bird 1, Bird 2, and Bird 3.
Importing cast members Importing lets you create cast members from external media. You can either import data into a Director movie file or create a link to the external file and re-import the file each time the movie opens. Linked files let you display dynamic media from the Internet, such as sports scores, sounds, and weather pictures, which makes downloading movies faster. For more information about linked files, see “About linking to files” on page 44.
6 From the Media pop-up menu at the bottom of the dialog box, select an option to specify how to treat imported media: Standard Import imports all selected files, storing them inside the movie file but not updating them when changes are made to the source material. If you selected the option to import from the Internet in step 3, Director retrieves the file immediately from the Internet if a connection is available.
To import files with Lingo or JavaScript syntax: • Use the importFileInto method to import a file. Set the fileName cast member property to assign a new file to a linked cast member. For more information about this property, see the Scripting Reference topics in the Director Help Panel. About import file formats Director can import files in all the formats listed in the following table. For information about additional file formats Director might support, see the Director Support Center website at www.
• To retrieve media from the Internet during playback, Director requires that the projector include certain Xtra extensions. To include these Xtra extensions automatically, click Add Network in the Movie Xtras dialog box. Movies playing in web browsers do not require these Xtra extensions. Note: Select Edit > Preferences > Network to define standard network settings for the Director authoring environment.
Launching external editors You can specify external applications to edit many types of media. All the types of media for which you can define an external editor are listed in the Editors Preferences dialog box. After you set up an external editor for a particular media type, Director starts the application when you edit a cast member of that type. When you finish editing a cast member in an external editor and then save and close the file, Director re-imports the cast member media.
2 Edit the cast member. If you change an image in the Paint window and then edit the image with an external editor, changes made in the Paint window, with the exception of registration points, are lost. Director warns you of this possibility. 3 Save and close the file. Director re-imports the cast member. Controlling cast member unloading When Director runs low on memory, it removes cast members from memory.
4 Click Create. The cast is created, and a Cast window for the cast appears in List view. For more information, see “Using the Cast window” on page 26. 5 Select File > Save while the Cast window is active, and save the cast in the desired directory. To link an external cast to a movie: 1 Select Modify > Movie > Casts. 2 In the Movie Casts dialog box, click Link. 3 Locate and select the external cast you want, and click Open. You can link to casts on your local disk or to casts that are stored at any URL.
Setting cast member properties using Lingo or JavaScript syntax Lingo or JavaScript syntax lets you control and edit cast members by setting their properties. Some properties are available for every type of cast member, and other properties are available only for specific cast member types. For more information about these properties, see the Scripting Reference topics in the Director Help Panel. To specify the cast member’s content: • Set the media cast member property.
To view or change Xtra cast member properties: 1 Select an Xtra cast member. 2 Open the Property inspector, and click the Member tab. The Member tab displays the following information about the member: ■ The cast member name ■ The name of the cast that contains the cast member ■ The size in kilobytes ■ The creation date ■ The date the cast member was last modified ■ The name of the user who last modified the cast member 3 Use the Name field to view or edit the cast member name.
CHAPTER 3 Sprites A sprite is an object that controls when, where, and how cast members appear in a Macromedia Director MX 2004 movie. Multiple sprites can use the same cast member. You can also switch cast members assigned to a sprite as the movie plays. You use the Stage to control where a sprite appears, and you use the Score to control when it appears in your movie. Sprites appear on the Stage layered according to the channel in which they are assigned in the Score.
Creating sprites You create a sprite by dragging a cast member to either the Stage or the Score: the sprite appears in both places. New sprites, by default, span 30 frames. To create a new sprite: 1 Click to select the frame in the Score where you want the sprite to begin. 2 From the Cast window, in either List or Thumbnail view, do one of the following: ■ ■ ■ Drag a cast member to the position on the Stage where you want to place the sprite. Drag a cast member to the Score.
Selecting sprites To edit or move a sprite, you must select it. You can select sprites, frames within sprites, and groups of sprites in several ways. You use the Arrow tool on the Tool palette to select sprites before most operations. You can also select sprites with the Rotate and Skew tool to enable rotation and skewing. See “Rotating and skewing sprites” on page 72. When selecting sprites, you often want to select a certain frame or range of frames within the sprite instead of the entire sprite.
• To select a contiguous range of sprites either on the Stage or in the Score, select a sprite at one end of the range and then Shift-click a sprite at the other end of the range. You can also drag to select all the sprites in an area. • To select discontiguous sprites, Control-click (Windows) or Command-click (Macintosh) the discontiguous sprites. To select a keyframe, do one of the following: • To select only a keyframe, click the keyframe indicator.
Naming sprites You can assign a name to a sprite by using the Property inspector and then view the sprite by name in the Score and on the Stage. Assigning a name lets you refer to the sprite by that name in Lingo or JavaScript syntax and not just by the channel number that it occupies. You can move a sprite to a different channel and not worry about changing scripts that once referred to the sprite by its channel number.
To view a sprite in the Score by its name: 1 In the Score, select the Sprite labels pop-up menu. 2 Select Name. All the sprites in the score appear with their sprite name listed. To view a sprite on the Stage by its name: • Select a sprite on the Stage. The sprite name appears on the second line of the sprite overlay. To edit the name of a sprite: 1 Select the sprite and open the Property inspector. 2 Enter a name in the Name text box.
Finding sprites You can search for and find sprites by name. When you have many sprites in a movie, searching for a sprite by name is easier and more efficient than searching by channel name or number. To find a sprite by name: 1 Select Edit > Find > Find Sprite. The Find Sprite dialog box opens with a list of the named sprites in the current cast. Note: Only the sprites that you have already named appear in the list. 2 In the Name text box, type the name of the sprite that you want to find.
To name a sprite channel: 1 Double-click a channel in the Score sprite channel column. A text box appears. 2 Type a name for the channel and press Enter. Layering sprites A sprite appears in front of other sprites on the Stage according to its channel. Sprites in highernumbered channels appear in front of sprites in lower-numbered channels. The rocket in channel 2 appears in front of the planet in channel 1. To change a sprite’s layer: 1 In the Score, select the sprite.
Displaying and editing sprite properties As you work with sprites in your movie, you’ll want to monitor and possibly modify sprite properties.
Note: To open a window in which you can edit the sprite’s cast member, you can double-click the thumbnail image. 3 Edit any of the following sprite settings in the Property inspector: Lock changes the sprite to a locked sprite so you or other users can’t change it. For additional information about locked sprites, see “Locking and unlocking sprites” on page 63. Editable applies only to text sprites and lets you edit the selected text sprite on the Stage during playback.
To show or hide the Sprite toolbar in the Score: • While the Score is active, select View > Sprite Toolbar. The Sprite toolbar is displayed across the top of the Score. Using the Sprite Overlay The Sprite Overlay displays important sprite properties directly on the Stage. You can open editors, inspectors, and dialog boxes to change sprite properties by clicking the corresponding icons in the Sprite Overlay.
To change the opacity of the Sprite Overlay: • Drag up or down the small thin line that appears on the right edge of the Sprite Overlay. . Displaying sprite labels in the Score Sprite labels appear in the Score’s sprite bars and display key information about the sprite in relation to the movie.
Behavior displays the behavior that is assigned to the sprite. Location displays the x and y coordinates of the sprite’s registration point. Ink displays the ink effect that is applied to each sprite. Blend displays the blend percentage. Extended displays any combination of display options; select options by selecting Edit > Preferences > Score. (If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences.
To lock a sprite: In the Stage or the Score, select one or more sprites to lock, and do one of the following: • Select Modify > Lock Sprite. • On the Sprite tab of the Property inspector, click the padlock icon. • Right-click (Windows) or Option-click (Macintosh), and select Lock Sprite from the context menu. In the Score, a locked sprite appears with a padlock in front of its name. On the Stage, a locked sprite appears with a padlock in its upper right corner.
The following diagram shows all the sprite coordinates you can specify. 0,0 Upper left corner of the Stage Bounding rectangle Top Left Registration point (X,Y) Right Height Bottom Width Director places the image of a cast member on the Stage by specifying the location of its registration point. For many cast members, such as bitmap or vector shapes, the registration point is in the center of the bounding rectangle by default.
Positioning sprites with the Property inspector You can use the Property inspector to specify the exact coordinates of a sprite. To set sprite coordinates in the Property inspector: 1 With the Property inspector open and in Graphical view, select a sprite to reposition.
4 To add a guide, move the cursor over the new horizontal or vertical guide, and then drag the guide to the Stage. Numbers in the guide tooltip indicate the distance, in pixels, the guide is located from the top or left edge of the Stage. 5 To reposition a guide, move the pointer over the guide. When the sizing handle appears, drag the guide to its new position. 6 To remove a guide, drag it off the Stage. 7 To remove all guides, click Remove All on the Guides tab in the Property inspector.
3 Select alignment buttons to modify the selected objects: ■ ■ For Align, select Align Left Edge, Align Horizontal Center, Align Right Edge, Align Horizontal Registration Point, Align Top Edge, Align Vertical Center, Align Bottom Edge, or Align Vertical Registration Point.
To determine whether two sprites overlap: • Use the sprite...intersects operator to determine whether a sprite’s bounding rectangle touches the bounding rectangle of a second sprite. Use the sprite...within operator to determine whether a sprite is entirely within a second sprite. For more information about these operators, see the Scripting Reference topics in the Director Help Panel. Changing when a sprite appears on the Stage A sprite controls where and when media appear on the Stage.
Changing the duration of a sprite on the Stage By default, Director assigns each new sprite a duration of 30 frames. You can change the duration of a sprite—that is, the amount of time the sprite appears in a movie—by adjusting its length, changing the number of frames in which it appears, or by using the Extend command. Director maintains the spacing proportions of keyframes when a sprite is lengthened. For a description of keyframes, see Chapter 4, “Animation,” on page 83.
To split an existing sprite: 1 In the Score, click the frame within a sprite where you want the split to occur. The playhead moves to the selected frame. 2 Select Modify > Split Sprite. Director splits the sprite into two new ones. To join separate sprites into a single sprite: 1 Select the sprites you want to join, as described in “Selecting sprites” on page 53. Director fills the gaps between the selected sprites. You can also select sprites in several channels.
To resize a sprite by dragging its handles: 1 Select the sprite. 2 On the Stage, drag any of the sprite’s resize handles. Hold down Shift while dragging to maintain the sprite’s proportions. To scale a sprite by pixels or by an exact percentage: 1 Select the sprite you want to scale and click the Sprite tab of the Property inspector (Graphical view). 2 Click the Scale button. The Scale Sprite dialog box appears.
Director can rotate and skew bitmaps, text, vector shapes, Macromedia Flash content, QuickTime videos, and animated GIFs. Director rotates a sprite around its registration point, which is a marker that appears on a sprite when you select it with your mouse. By default, Director assigns a registration point in the center of all bitmaps. You can change the location of the registration point by using the Paint window. For more information, see “Changing registration points” on page 112.
To rotate or skew a sprite with the Property inspector: 1 Select the sprite you want to rotate or skew and click the Sprite tab in the Property inspector (List view). 2 To rotate the selected sprite, display the Rotation pop-up menu and enter the number of degrees in the Rotation text box. 3 To skew the selected sprite, display the Skew pop-up menu and enter the number of degrees in the Skew text box.
Flipping sprites Flipping a sprite creates a horizontally or vertically inverted image of the original sprite. To flip a sprite: 1 Select a sprite. 2 Do any of the following: ■ ■ ■ Click the Flip Vertical or Flip Horizontal button on the Sprite tab in the Property inspector to flip the sprite without moving the registration point or changing the current skew or rotation angles.
To change the color of a sprite with Lingo or JavaScript syntax, set the appropriate sprite property: • The color sprite property sets the sprite’s foreground color. The value is an RGB value. • For more information about this property, see the Scripting Reference topics in the Director Help Panel. The bgColor sprite property sets the sprite’s background color. The value is an RGB value. For more information about this property, see the Scripting Reference topics in the Director Help Panel.
Using sprite inks You can change a sprite’s appearance on the Stage by applying inks. Sprite inks change the display of a sprite’s colors. Inks are most useful to hide white bounding rectangles around images, but they can also create many compelling and useful color effects. Inks can reverse and alter colors, make sprites change colors depending on the background, and create masks that obscure or reveal portions of a background.
Black areas of a mask cast member make the sprite completely opaque in those areas, and white areas make it completely transparent (invisible). Colors between black and white are more or less transparent; darker colors are more opaque. When creating a bitmap mask for a sprite, use a grayscale palette if the mask cast member is an 8-bit (or less) image. An 8-bit mask affects only the transparency of the sprite and does not affect the color.
Ink definitions The following definitions describe all available ink types. Copy displays all the original colors in a sprite. All colors, including white, are opaque unless the image contains alpha channel effects (transparency). Copy is the default ink and is useful for backgrounds or for sprites that don’t appear in front of other artwork. If the cast member is not rectangular, a white box appears around the sprite when it passes in front of another sprite or appears on a nonwhite background.
Subtract subtracts the RGB color value of the foreground sprite’s color from the RGB value of the background sprite’s color to determine the new color. If the color value of the new color is less than 0, Director adds 256 so the remaining value is between 0 and 255. Subtract Pin subtracts the RGB color value of pixels in the foreground sprite from the value of the background sprite. The value of the new color is not allowed to be less than 0.
Exchanging cast members The Exchange Cast Members command changes the cast member associated with a particular sprite to the currently selected cast member; that is, it replaces the member reference for the selected sprite with the member reference of the selected cast member. This command modifies the selected sprites in the score; it doesn’t modify cast members. The command is enabled only when both a sprite and a cast member are selected.
Chapter 3: Sprites
CHAPTER 4 Animation Animation is the appearance of an image changing over time. The most common types of animation in Macromedia Director MX 2004 involve moving a sprite on the Stage (tweening animation) and using a series of cast members in the same sprite (frame-by-frame animation). • Tweening is a traditional animation term that describes the process in which a lead animator • draws the animation frames where major changes take place, called keyframes. Assistants draw the frames in between.
To open the Sprite Tweening dialog box: • Select a sprite, then select Modify > Sprite > Tweening. A keyframe usually indicates a change in sprite properties. Properties that can be tweened are position, size, rotation, skew, blend, and foreground and background color. Each keyframe defines a value for all of these properties, even if you only explicitly define one.
3 Insert keyframes in any additional frames where you want the sprite’s animation path to change. 4 Drag the red handle within the sprite to the place on the Stage where you want the sprite’s path to end. The red handle represents the sprite’s location in the end frame. For bitmaps, the red handle is usually in the center of the image. For vector shapes and other media types, the handle is often in the upper left corner. 5 Director displays the path the sprite follows.
• The Speed settings control how Director moves a sprite between each keyframe. The Sharp Changes option is the default setting. Using this option, Director calculates how to move the sprite between each pair of keyframes separately. If a sprite’s keyframes are separated by unequal numbers of frames in the Score, or by different amounts of space on the Stage, abrupt changes in speed may occur as the sprite moves between keyframe locations.
5 To define the beginning property settings, click the Sprite tab of the Property inspector and do any of the following: ■ To make the sprite fade in or out, enter a blend setting in the Property inspector (in List view). Enter 0 to make the sprite fade in or 100 to make it fade out. For more information, see “Setting blends” on page 76. ■ To tween rotation or skew, manually rotate or skew the sprite to the beginning position on the Stage or enter an angle in the Property inspector.
Changing tweening settings To change tweening properties for sprites, you use the Sprite Tweening dialog box. You can turn tweening on and off for certain properties and control the curve of a tweening path and the way the speed changes as a sprite moves. For information about creating tweened animation, see “Tweening the path of a sprite” on page 84. To change tweening settings: 1 Select a tweened sprite on the Stage or in the Score.
Switching a sprite’s cast members To show different content while maintaining all other sprite properties, you exchange the cast member assigned to a sprite. This technique is useful when you have tweened a sprite and you decide to use a different cast member. When you exchange the cast member, the tweening path stays the same. To exchange cast members in the Score: 1 To change a cast member in every frame, select an entire sprite. To change a cast member only in certain frames, select part of a sprite.
When Edit Sprite Frames is turned on for a certain sprite, clicking the sprite selects a single frame. Any change you make to a tweenable property, such as moving a sprite on the Stage, defines a new keyframe. To use Edit Sprite Frames, do one of the following: • Select a sprite or sprites and select Edit > Edit Sprite Frame. • Alt-double-click (Windows) or Option-double-click (Macintosh) a frame within the sprite.
To animate a sprite with multiple cast members: 1 Create a sprite by placing the first cast member in the animation on the Stage in the appropriate frame. 2 Change the length of the sprite as needed. 3 4 5 6 7 8 9 Drag the start or end frame in the Score, or enter a new start or end frame number in the Sprite Inspector. Select View > Display > Cast Member. This setting displays the name of the cast member on each sprite. For more information, see “Displaying sprite labels in the Score” on page 62.
Shortcuts for animating with multiple cast members The Cast to Time and Space to Time commands are both useful shortcuts for animating with multiple cast members. Using the Cast to Time command To move a series of cast members to the Score as a single sprite, you use the Cast to Time command (Modify > Cast to Time), which is one of the most useful methods for creating animation with multiple cast members.
Using the Space to Time command To move sprites from adjacent channels to a single sprite, you use the Space to Time command (Modify > Space to Time). This method is convenient when you want to arrange several images on the Stage in one frame and then convert them to a single sprite. Arrange sprites on the Stage in a single frame. Space to Time converts sprites from adjacent channels to a single sprite.
Using film loops A film loop is an animated sequence that you can use like a single cast member. For example, to create an animation of a bird flying across the Stage, you can create a film loop of the sequence of cast members that shows the bird flapping its wings. Instead of using the frame-by-frame technique, you create a sprite containing only the film loop and then animate it across as many frames as you need.
Director provides three other ways of incorporating a completed animation into a movie as a discrete element: you can export it as a digital video (QuickTime or AVI) or a DIB file (BMP), save and import it as a linked Director movie, or play it in a window in another Director movie. Note: If you need to edit a film loop and you have deleted the original Score data that it was based on, it is possible to restore the Score data for editing.
Step-recording animation Step recording is a process of animating one frame at time. You record the position of a sprite in a frame, step forward to the next frame, move the sprite to its new position, step forward to the next frame, and so on until you have completed the animation. This method is useful for creating sprites that follow irregular paths. To step-record animation: 1 Place sprites on the Stage where you want the animation to begin. 2 Select all the sprites you want to animate.
To use real-time recording: 1 Select one or more sprites on the Stage or in the Score. Recording begins at the playhead. It is best to select a sprite in a channel that contains no other sprites later in the movie. To record in a specific range of frames, select the frames, and then click the Selected Frames Only button in the Control panel. 2 Select Control > Real-Time Recording.
Chapter 4: Animation
CHAPTER 5 Bitmaps Bitmaps and vector shapes are the two main types of graphics used with Macromedia Director MX 2004. A bitmap defines an image as a grid of colored pixels, and it stores the color for each pixel in the image. A vector shape is a mathematical description of a geometric form that includes the thickness of the line, the fill color, and additional features of the line that can be expressed mathematically. Bitmaps are suited for continuous tone images such as photographs.
A bitmap typically requires more RAM and disk space than a comparable vector shape. If not compressed, bitmaps take longer than vector shapes to download from the Internet. Fortunately, Director offers compression control to reduce the size of bitmaps in movies that you package to play on the web. For more information about bitmap compression, see “Compressing bitmaps” on page 129. For more information about vector shapes, see Chapter 6, “Vector Shapes,” on page 135.
Using animated GIFs You can import an animated GIF into Director with File > Import, similar to the way in which you import any other bitmap cast member. The only difference is that when the Select Format dialog box appears, you select Animated GIF. Director supports both the GIF89a and GIF87 formats. GIFs must have a global color table to be imported. You can import an animated GIF within a movie file or link to an external file.
Using the Paint window The Paint window has a complete set of paint tools and inks for creating and changing bitmap cast members for movies. Anything you draw in the Paint window becomes a cast member. When you make a change to a cast member in the Paint window, the image in the Cast window is instantly updated—as is the cast member wherever it appears on the Stage. To open the Paint window, do any of the following: • • • • Select Window > Paint. Click the Paint window icon on the toolbar.
To erase, do one of the following: • Click and drag the Eraser tool to erase pixels. • Double-click the Eraser tool to erase the cast member. To move the view of the Paint window, do one of the following: • Click and drag the Hand tool to move the visible portion of the image within the Paint window. • Shift-drag to move straight horizontally or vertically. Press the Spacebar to temporarily activate this tool while using other paint tools.
To brush strokes of the foreground color: • Click the Brush tool, and drag it in the Paint window. To constrain the stroke to horizontal or vertical, Shift-click and drag. To select a new brush type: • Click the Brush tool, and hold down the mouse button to select a new brush type from the pop-up menu. Select Settings to change the selected brush. For more information, see “Using the Brush tool” on page 107. To paint shapes or lines: • Click and drag the shape tools.
To select a pattern for the foreground color, do one of the following: • To change the pattern palette, select Pattern Settings at the bottom of the Patterns pop-up menu. Patterns • To define a tile—a pattern that is based on a rectangular section of an existing cast member— select Tile Settings from the Patterns pop-up menu. For more information, see “Editing patterns” on page 120 and “Creating a custom tile” on page 120.
Using the Lasso tool You use the Lasso tool to select irregular areas or polygons. After you select artwork, it can be dragged, cut, copied, cleared, or modified with the effects on the Paint toolbar. The Lasso tool selects only those pixels of a color that are different from the color the Lasso tool was on when you first started dragging it. You use the Lasso pop-up menu to change settings.
To change marquee settings: • Click the Marquee tool, hold down the mouse button, and select from the following options: Shrink causes the rectangle to shrink around the selected artwork. lets you select everything within the marquee. Lasso tightens the marquee around the object in the same way as the Lasso tool and selects the pixels according to the color of the pixel beneath the cross hair when you started the drag.
To change brush settings: 1 Click the Brush tool, and hold down the mouse button. 2 Select the menu item for which you want to define settings. 3 Open the menu again, and select Settings from the Brush pop-up menu. Enter values for the options in the Brush Settings dialog box. You can also double-click the Brush tool to open the Brush Settings dialog box. 4 To select from the default brush shapes, select Standard from the pop-up menu, and click a brush shape in the chart below the pop-up menu.
• Control-click (Windows) or Command-click (Macintosh) the image to zoom in on a particular place. To return to normal view, do one of the following: • Click the normal-sized image in the upper right corner. • Select View > Zoom > 100%. Changing selected areas of a bitmap After you select part of an image in the Paint window with the Lasso or Marquee tool, you can change the selected area.
Note: To repeat any of these effects after using them, press Control+Y (Windows) or Command+Y (Macintosh). To flip, rotate, skew, or apply effects to part of a bitmap: 1 Select part of a bitmap in the Paint window with the Marquee tool. 2 Use any of the following effects: ■ ■ ■ ■ ■ ■ ■ 110 To flip the selection, click the Flip Horizontal button to flip right to left, or click the Flip Vertical button to flip top to bottom.
To apply color effects to a selected area: 1 Select an area within a bitmap cast member by using either the Marquee or the Lasso tool. 2 Use any of the following effects: ■ ■ ■ ■ ■ To soften the edges of the selected artwork, click the Smooth button. This effect works only with 8-bit cast members. To reverse the colors of the selected area, click the Invert button. To increase or reduce the brightness of the selected area, click the Lighten Color or Darken Color button.
Changing registration points A registration point is a marker that appears on a sprite when you select it with your mouse. (Registration points don’t appear on unselected sprites or when a movie is playing.) Registration points provide a fixed reference point within an image, thereby helping you align sprites and control them from Lingo or JavaScript syntax. Registration points are crucial to precisely placing vector shapes, bitmaps, and all cast members that appear on the Stage.
3 Click a location in the Paint window to set the registration point. You can also drag the dotted lines around the window to reposition the registration point. Note: To reset the default registration point at the center of the cast member, double-click the Registration Point tool. To set a bitmap’s registration point with Lingo or JavaScript syntax: • Set the regPoint cast member property.
5 To change the palette, select a palette from the Palette pop-up menu and select one of the following remapping options: Remap Colors replaces the original colors in the graphic with the most similar solid colors in the new palette. This is the preferred option in most cases. Dither blends the colors in the new palette to approximate the original colors in the graphic. 256 grays Remapped to closest colors in black and white Dithered in black and white 6 Click Transform to execute the changes.
To change the image assigned to a bitmap cast member: • Set the picture cast member property. For more information about this property, see the Scripting Reference topics in the Director Help Panel. To specify the background or foreground of a bitmap sprite: • Set the backColor or foreColor sprite property. For more information about these properties, see the Scripting Reference topics in the Director Help Panel.
The following statement draws a line on the previously created 640 x 480 image object myImage, running from 20 pixels inside the upper left corner to 20 pixels inside the lower right corner, and colors it blue: myImage.draw(20, 20, 620, 460, rgb(0, 0, 255)) To draw a rectangle on an image object: • Use the fill() method. You provide the same information as for the draw method, but Director draws a rectangle instead of a line.
Using gradients Director can create gradients in the Paint window. You can use gradients with the Brush tool, the Bucket tool, the Text tool, or any of the filled shape tools. Typically, a gradient consists of a foreground color at one side (or the center) of an image and another color, the destination color, at the other side (or outside edge) of the image. Between the foreground and destination colors, Director creates a blend of the two colors.
To edit gradient settings: 1 Select Gradient Settings from the Gradient Colors pop-up menu. Gradient pop-up menu 2 To determine whether the gradient is created with the pattern you select with the Patterns pop- up menu in the Paint window or with a dithered pattern, select a Type option, as described in the following list: Dither produces a smooth transition between colors. If you select Dither, only dithering options appear in the Method pop-up menu.
Left to Right 5 6 7 8 9 puts the foreground color on the left and the destination color on the right. Right to Left puts the foreground color on the right and the destination color on the left. Directional lets you determine the direction of the gradient. You set the direction of the gradient in the Paint window with the paint tool used to fill the area. Shape Burst creates a gradient that starts at the edge of the area and moves toward the center.
Using patterns You can select among three sets of patterns that are included with Director or create custom patterns. The patterns you change or edit in the Paint window don’t affect the patterns that are available for shapes. To use a pattern: 1 Select the Brush tool, the Bucket tool, or one of the filled shape tools. 2 Select the type of pattern from the Patterns pop-up menu. To manually specify a pattern, select Pattern Settings from the pop-up menu.
To create a custom tile: 1 Create a bitmap cast member to use as a tile, and display it in the Paint window. 2 Click the pattern box in the Paint window, and select Tile Setting from the bottom of the 3 4 5 6 Patterns pop-up menu. Click an existing tile position to edit. The existing tiles appear next to the Edit label. You must replace one of the built-in tiles to create a new one. To restore the built-in tile for any tile position, select it, and click Built-in. Click Cast Member.
Ink B&W Color Works with Lighten ✔ Brush Smooth ✔ Brush Smear ✔ Brush Smudge ✔ Brush Spread ✔ ✔ Brush Clipboard ✔ ✔ Brush Normal is the default ink. It is opaque and maintains the color of the current foreground color and pattern. Transparent ink makes the background color of patterns transparent so artwork drawn previously in the current cast member can be seen through the pattern. Reverse ink makes overlapping colors reverse.
Darken makes colors darker. The more times you click with the Brush tool, the darker the area becomes. The colors of the foreground, background, and destination inks have no effect on Darken. Darken creates an effect that is the same as reducing a color’s brightness with the controls in the Color Palettes window. You can change the rate of this ink effect in the Paint Preferences dialog box. Lighten makes colors lighter. The more times you click with the Brush tool, the lighter the area becomes.
To install a filter: • Place the filter in the Xtras folder in the Director application folder. For more information about installing Xtra extensions, see the Getting Started topics in the Director Help Panel. To apply a filter: 1 Open the cast member in the Paint window, or select the cast member in the Cast window. You can apply a filter to several cast members at once by selecting them all in the Cast window.
5 Enter the number of new cast members you want to create. The text box is not available if you selected a range of cast members. 6 Click Filter to begin the filtering. A message appears to show the progress. Some filters are complex and require extra time for computing. Auto Filter generates new cast members and places them in empty cast positions following the selected cast member.
To define the number of preceding or following cast members to display: 1 Open the Paint window, and select View > Onion Skin. The Onion Skin toolbar appears. 2 If necessary, click the Toggle Onion Skinning button on the Onion Skin toolbar to activate onion skinning. 3 Specify the number of preceding or following cast members you want to display. ■ To specify the number of preceding cast members to display, enter a number in the Preceding Cast Members text box.
To use a series of images as a background while painting a series of foreground images: 1 In the Cast window, arrange the series of cast members you want to use as your background in consecutive order. Cast members in the foreground and the background series must be adjacent to each other in the cast. 2 Open the Paint window, and select View > Onion Skin. The Onion Skin toolbar appears. The Onion Skin toolbar appears.
Setting bitmap cast member properties To view important information about cast members, change a cast member’s name, select alpha settings, or turn on highlighting and dithering, you use bitmap cast member properties. To view or change bitmap cast member properties: 1 Select a bitmap cast member, and click the Member tab in the Property inspector using the 2 3 4 5 6 7 8 9 Graphical view.
Setting Paint window preferences You can use Paint window preferences to modify the settings of several tools and drawing methods in the Paint window. To change Paint window preferences: 1 Select Edit > Preferences > Paint. Note: If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences.
In addition to Director standard compression, you can use JPEG compression and specify a range of image quality. If you have Fireworks installed, you can use the Optimize in Fireworks button to start Fireworks and then dynamically apply compression settings while viewing how your image looks at those settings. When you determine the most suitable compression level, Director remembers the settings you established in Fireworks.
Working with Macromedia Fireworks You can combine the power of Macromedia Fireworks and Director. Fireworks lets you export graphics and interactive content into Director. The export process preserves the behaviors and slices of the graphic. You can safely export sliced images with rollovers and even layered images. Director users can take advantage of the optimization and graphic design tools of Fireworks without compromising quality.
Importing Fireworks files into Director In Director, you can import flattened images that you have exported from Fireworks, such as JPEGs, GIFs, and 32-bit PNGs. You can also import Fireworks layers, slices, and interactive elements by inserting Fireworks HTML. To import a flattened Fireworks image: 1 In Director, select File > Import. 2 Navigate to the desired file, and click Import. 3 Change options, if desired, in the Image Options dialog box.
Editing Director cast members in Fireworks Using launch-and-edit integration, you can make changes to Director cast members by starting Fireworks and editing them from inside Director. You can also start Fireworks from inside Director to optimize cast members. To start Fireworks and edit a Director cast member: 1 In Director, right-click (Windows) or Control-click (Macintosh) the graphic in the Cast window. 2 Select Launch External Editor from the context menu.
Chapter 5: Bitmaps
CHAPTER 6 Vector Shapes Vector shapes and bitmaps are the two main types of graphics used with Macromedia Director MX 2004. A vector shape is a mathematical description of a geometric form that includes the thickness of the line, the fill color, and additional features of the line that can be expressed mathematically. A bitmap defines an image as a grid of colored pixels, and it stores the color for each pixel in the image.
• • • • • The first vertex in a curve is green. The last vertex in a curve is red. All other vertices are blue. Unselected vertices are solid. Selected vertices are unfilled. To open the Vector Shape window: • Select Window > Vector Shape. Zooming in and out in the Vector Shape window You can use the Magnify tool or the Zoom commands on the View menu to zoom in or out at four levels of magnification.
To create a vector shape using the Pen tool: 1 In the Vector Shape window, click the New Cast Member button. 2 Click the Pen tool and begin to draw: ■ ■ ■ To create a corner point, click once. To create a curve point, click and drag. Dragging creates control handles that define how the line curves through the point that you define. To constrain a new point to vertical, horizontal, or a 45° angle, hold down Shift while clicking.
Choosing fill and line settings for vector shapes You can use either controls in the Vector Shape window or Lingo or JavaScript syntax to choose a vector shape’s fill color, line width and color, and background color. The background is the area outside of a vector shape but within the cast member’s bounding rectangle. Because a vector shape is a single object, you don’t need to select any part of the vector shape to make the following changes.
To specify a vector shape’s fill in script: • Set the fillColor, fillMode, fillOffset, and fillScale cast member properties. For more information about these properties, see the Scripting Reference topics in the Director Help Panel. Editing vector shapes To edit vector shapes, you use the Vector Shape window. You change vector shapes by moving, adding, or deleting control points and changing the way they control curves.
To join two curves: 1 Select a vertex in each curve. If you select two endpoint vertices, you join them. If you select points in the middle of the curve, you join the start of the second curve to the end of the first curve. 2 Select Modify > Join Curves. To split two curves: • Select two adjacent vertices, and select Modify > Split Curves. To change the registration point: 1 Click the Registration Point tool. The dotted lines in the window intersect at the registration point.
Defining gradients for vector shapes You can use controls in the Vector Shape window or Lingo or JavaScript syntax to specify the type of gradient, how it is placed within a shape, and how many times it cycles within the shape. A gradient for a vector shape shifts between the fill color and the end color you define. You can create linear or radial gradients. Changes you make to vector shape gradients have no effect on gradients for bitmaps in the Paint window.
Controlling vector shapes with Lingo or JavaScript syntax You can use script to modify a vector shape by setting properties and using methods related to the shape’s vertices. For more information about the following properties, expressions, and methods, see the Scripting Reference topics in the Director Help Panel. • To display a list that contains the location of each vertex and control handle in a vector shape, • • • • • • • test the vertexList property.
9 To specify how vector shapes are scaled on the Stage, select an option from the Scale Mode pop-up menu. Show All maintains the vector shape’s aspect ratio and, if necessary, fills in any gap along the horizontal or vertical dimension using the vector shape’s background color. No Border maintains the vector shape’s aspect ratio by cropping the horizontal or vertical dimension as necessary without leaving a border.
Setting shape cast member properties You can use cast member properties to view and change settings for selected shape cast members. You can change the type of shape and choose a new fill color or pattern. You can also use Lingo or JavaScript syntax to control shape cast member properties. To view or change shape cast member properties: 1 Select a shape cast member and open the Property inspector in Graphical view. 2 Use the Name text box on the Member tab to view or edit the cast member name.
CHAPTER 7 Color, Tempo, and Transitions Several behind-the-scenes functions in Macromedia Director MX 2004 are important to the appearance and performance of a movie. To control the way Director manages colors, it’s important to understand the difference between RGB and index color, and how to assign colors to various elements in your movie. See the next section. To control the speed at which your movie plays, you use settings in the tempo channel. For more information, see “About tempo” on page 157.
Specifying palette index and RGB color Director can use either palette index values or RGB values to specify colors. RGB values are much more reliable and accurate for specifying colors than palette index values. RGB is the system that most web pages use. Director identifies a palette index color by the number of its position in a set of colors called a color palette. Color number 12, for example, might be blue. If a different palette is active, color number 12 might be red.
Changing the color depth of a movie When you save a Director movie, it is set to the same color depth as the system on which you are authoring. You can use Lingo or JavaScript syntax to reset the system color depth to match the color depth of a movie. For more information, see the Scripting Reference topics in the Director Help Panel. If you want to set the color depth of a movie without using script, you can use system utilities to change the color depth of your system before you save the movie file.
To open the Color menu: 1 Do one of the following: Select a sprite and display the Sprite tab of the Property inspector. Select Window > Tool Palette. 2 Click and hold the mouse button while pointing at the Foreground Color and Background Color buttons. ■ ■ Note: To open the Color menu in the opposite mode (RGB or index), hold down the Alt key (Windows) or Option key (Macintosh) while clicking the color box. To select colors not on the Color menu: 1 Open the Color menu. 2 Click Color Picker.
To change the color palette displayed on the Color menu: 1 Select Window > Color Palettes or double-click the mouse button on the Foreground Color and Background Color buttons in the Tool palette. 2 Select a color palette from the Palette pop-up menu. Changing color palettes during a movie The palette channel in the Score determines which palette is active for a particular frame in a movie. To define the palette that is active in a particular frame of a movie, use Modify > Frame > Palette.
To specify a palette: 1 In the Score, do one of the following: Double-click the cell in the palette channel where you want the new palette setting to appear. ■ Right-click (Windows) or Control-click (Macintosh) the cell in the effects channel where you want the new palette setting to appear, and then select Palette from the Context menu. ■ Select the cell in the effects channel where you want the new palette setting to appear, and then select Palette from the Score window’s Options menu.
Using the Color Palettes window Use the Color Palettes window to change and rearrange color palettes and to determine which colors in a palette are used in an image. This section explains basic features of the Color Palettes window. Select a palette to change Tools Reserve, select, and rearrange colors Define a new color If you add new palettes to your movie from other graphics applications, those palettes appear in the palette list and in the Cast window.
7 Select Modify > Transform Bitmap and select the desired options. Note: Be sure to select Remap Colors, not Dither. 8 Click Transform to remap all the cast members to the new palette. To select one or more colors: 1 Click a color in the Color Palettes window. If the selection arrow is not active, click the Arrow tool at the bottom of the window. 2 To select a range, drag across colors or click the first color in the range, and then Shift-click the last.
To select colors in the palette used by the current cast member: 1 In the Cast window, select the cast member. 2 Select Window > Color Palettes. Select Used button Invert Selection button 3 Click the Select Used Colors button in the Color Palettes window. 4 In the Select Colors Used In Bitmap dialog box, click Select. To select all colors not currently selected: • Click the Invert Selection button in the Color Palettes window.
To edit selected colors in the Color Palettes window: 1 Select Window > Color Palettes. 2 Select the palette you want to change from the Palette pop-up menu. 3 Select a color within the palette to change. If you attempt to change one of the default palettes, Director makes a copy of the palette and prompts you to enter a name. 4 To change the color using the H, S, and B (hue, saturation, and brightness) controls, click the arrows next to the controls.
To solve color palette problems, follow these guidelines: • To avoid color problems in movies for the web, map all 8-bit bitmaps in your movie to the • • • • • • • Web216 color palette that is built in to Director. This is essentially the same palette used by Netscape Navigator and Microsoft Internet Explorer. Do not attempt to change palettes while a movie is playing in the browser. The browser, not the Director movie, controls the palette. Browsers ignore all palette channel settings.
3 From the Palette pop-up menu, select the palette that you want to use to create a new palette cast member. 4 Double-click any color within the palette. Director makes a copy of the palette and prompts you to enter a name. 5 In the Create Palette dialog box, enter a name and click the OK button. 6 The Color dialog box opens. Make any changes you want and click the OK button. 7 The new color palette appears in the Cast window bearing the name you gave it.
About tempo Tempo is the number of frames per second that Director tries to play. You can control tempo by using the Score tempo channel or the puppetTempo method. Director tempo settings control the maximum speed at which the playhead moves from frame to frame. The tempo doesn’t affect the duration of any transitions set in the transition channel, nor does it control the speed at which a sound or digital video plays.
To specify a tempo setting: 1 In the Score, do one of the following: Double-click the cell in the tempo channel where you want the new tempo setting to appear. ■ Right-click (Windows) or Control-click (Macintosh) the cell in the effects channel where you want the new tempo setting to appear, and then select Tempo from the Context menu. ■ Select a frame in the tempo channel, and select Modify > Frame > Tempo. If you don’t see the tempo channel, the effects channel is hidden.
Comparing actual speed with tempos It’s good practice to test the performance of your movie on a system that is similar to that of your users. Make sure the movie plays well on the slowest systems likely to be used. The tempo you’ve set and the actual speed of a movie both appear in the floating Control panel. Actual tempo Tempo setting Step Forward Note: The Control panel attached to the bottom of the Stage does not include tempo settings.
Using transitions Transitions create brief animations that play between frames to create a smooth flow as sprites move, appear, or disappear or as the entire Stage changes. Director provides dozens of transitions built into the application, and many third-party Xtra extensions also include transitions. For example, you can dissolve from one scene to the next, display a new scene strip by strip, or switch to a scene as though revealing it through venetian blinds.
Tips for using transitions Here are some points to remember when working with transitions: • To play a sound while a transition occurs, place the sound in the frame immediately before • • • • • the transition. The Dissolve Pixels, Dissolve Pixels Fast, or Dissolve Patterns transitions might look different on Windows and Macintosh systems. Test to ensure satisfactory results. If you export a movie that contains transitions as a digital video or PICS file, the transitions might not be preserved.
Setting transition cast member properties You use the Property inspector to set values for the transition cast member. To view or change transition cast member properties: 1 Select a transition cast member. 2 To display the Property inspector, select Modify > Cast Member > Properties, or select Window > Property Inspector. 3 If necessary, click the Member tab and display the Graphical mode.
CHAPTER 8 Text Macromedia Director MX 2004 creates text that is editable, anti-aliased, and compact for fast downloading of outline fonts on both the Macintosh and Windows platforms. Combine these features with any of the animation capabilities of Director, such as rotation, and you can create wonderful text effects in your Director movies. You can embed fonts in a movie to ensure that text appears in a specific font when a movie is delivered, regardless of which fonts are available on the user’s computer.
Embedding fonts in movies Before creating text or field cast members, it’s good practice to embed the fonts you want to use in the movie. Embedding fonts makes Director store all font information in the movie file so that a font displays properly even if it is not installed in a user’s system. Because embedded fonts are available only to the movie, there are no legal obstacles to distributing fonts in Director movies.
To embed a font in a movie with Lingo or JavaScript syntax: • Use the recordFont method. For more information about this method, see the Scripting Reference topics in the Director Help Panel. Creating text cast members You can create text within Director or import text from external files. Creating text in Director Director provides two ways to create text cast members: directly on the Stage or in the Text window.
When you import text from an HTML document, Director recognizes many standard tags and parameters, including tables, and approximates the formatting. Director does not recognize embedded objects other than tables, and it does not support nested tables. It also does not recognize APPLET, FORM, FRAME, INPUT, or IMAGE tags. Director ignores any tags it does not recognize. For HTML files that are updated frequently, make sure you’re satisfied with the formatting when importing.
3 Use the Text inspector (Window > Text Inspector) to reformat the text. You can also use the Modify > Font and Modify > Paragraph commands to reformat selected text. When you make a change, Director updates all sprites that display the text cast member. Note: If you’re changing the background color of text, you have two options. To change the background color of the cast member, double-click the text sprite on the Stage and assign a value from the Color box on the Tool palette.
To make formatting changes to a paragraph: 1 Double-click the text sprite in the Score or the text cast member in the Cast window to open the Text window. 2 If the ruler is not visible, select View > Rulers. To change the unit of measure on the text ruler, select Edit > Preferences > General, and select Inches, Centimeters, or Pixels from the Text Units pop-up menu. Note: If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences.
Formatting entire cast members Director can apply formatting changes to entire cast members. This process is much faster than manually opening each cast member and applying changes. Any change you apply to a cast member affects all the text within the cast member. To format text cast members: 1 In a Cast window or on the Stage, select the cast members you want to change. You can select as many cast members as you want to change.
About anti-aliased text Anti-aliased text is text that uses color variations to make its jagged angles and curves look smoother. Director activates anti-aliasing by default. You can change this setting on the Text tab of the Property inspector (for more information, see “Setting text or field cast member properties” on page 174). Anti-aliasing functions the same way for embedded fonts and for system fonts that have not been embedded (see “Embedding fonts in movies” on page 164).
6 To specify the cast members in which to search, select one of the following Search options: Cast Member [Cast Member Name] limits the search to the current cast member. limits the search to cast members in the current cast. All Casts extends the search to all cast members in all casts. 7 To set additional search options, select Wrap-Around, Whole Words Only, or Case Sensitive. Wrap-Around specifies whether Director returns to the beginning of text after it reaches the end.
Working with fields Working with field cast members is similar to working with text. As with text cast members, you edit fields on the Stage or in a window, and apply formatting with the Text inspector. Not all text formatting options are available for fields: you can’t apply spacing, tabs, or indents to individual paragraphs within fields. Alignment settings apply to every paragraph in the field. To create a field cast member: 1 Perform one of the following actions: ■ ■ Select Insert > Control > Field.
To make a text sprite editable in a range of frames: 1 Select a range of frames within a sprite. You can select an entire sprite, or Shift-Alt-click (Windows) or Shift-Option-click (Macintosh) to select frames within a sprite. 2 Click the Property inspector’s Text or Field tab by using the Graphical view. 3 Click Editable. To control whether text is editable with Lingo or JavaScript syntax: • Set the editable property.
Windows font Macintosh font Terminal Monaco Times New Roman Times (because Times New Roman is larger than Times, Fontmap.txt assigns a smaller point size.) Fontmap.txt also determines the scaling of fonts and how special characters such as bullets and symbols are translated between platforms. Again, the default settings are correct for nearly all applications, but you can edit the settings if necessary You can also load and save fontmaps by using the Property inspector.
6 To specify how Director removes the cast member from memory if memory is low, select an option from the Unload pop-up menu. For more information, see “Controlling cast member unloading” on page 47. 7 To change the text of the cast member, click Edit. 8 Click the Property inspector’s Text or Field tab by using the Graphical view.
12 To control how Director anti-aliases text for a text cast member, select one of the following Anti-Alias options: All Text anti-aliases all the text in the text block. Larger Than anti-aliases only text that is larger than the point size entered in the Points text box. None turns off anti-aliasing for the current cast member. Anti-aliasing dramatically improves the appearance of large text, but it can blur or distort smaller text.
Formatting text with Lingo or JavaScript syntax Lingo or JavaScript syntax can format text in an entire cast member or any specific chunk of text. Use the following properties: • To select or identify a chunk of text in a field cast member, use the selStart and selEnd cast member properties. These properties identify the first and last characters of a text selection. • To refer to a selected chunk of text, use the selection cast member property.
Formatting text or field cast members with Lingo or JavaScript syntax In addition to formatting text in any chunk expression, Lingo or JavaScript syntax can specify anti-aliasing and kerning for an entire text cast member and control the appearance of the text’s bounding rectangle.
Controlling scrolling text with Lingo or JavaScript syntax You can script in Lingo or JavaScript syntax to scroll text and determine the location of specific text within the text box for text and field cast members. For example, this statement sets the scrollTop value for the text cast member called Discussion to 0, which makes its first line appear at the top of its scrolling field: member("Discussion").
Modifying strings with Lingo or JavaScript syntax As time passes or other conditions change, you might want to update and change text. For example, you might want to frequently update a text sprite that displays the user’s name or a description of a musical selection that the user is currently streaming from a website. For more information, see the Scripting Reference topics in the Director Help Panel.
CHAPTER 9 Using Flash, Flash Components, and Other Interactive Media Types To add complex media and new capabilities to your Macromedia Director MX 2004 movie, you can use Macromedia Flash content (MX or later), Flash components, other Director movies, and ActiveX controls. Each of these multimedia formats has interactive capabilities that are preserved by Director. Flash content in a Director movie provides a vector-based, scalable, interactive animation that is optimized for use on the web.
In Flash, you can create cross-platform Windows and Macintosh movies and then play or manipulate them in Director. You can create Flash content that communicates with your Director movie by sending events that Director scripts can capture and process. You can store entire Flash files in the Director cast file, or you can link to external Flash content. Director automatically loads the Flash content it encounters in the Score into memory from disk, from a network drive, or from anywhere on the Internet.
4 Select Playback options to control how a Flash content sprite plays in a Director projector, in Shockwave content, and while you are authoring in Director: displays the image of the Flash content when it plays. When Image is deselected, the Flash movie is invisible. Sound enables any sound in the Flash content to play. When Sound is deselected, the movie plays without sound. Paused displays only the first frame of the movie without playing the movie.
About using Flash content in a Director movie Once you have added Flash content to the Director cast, using it in your movie is as simple as dragging it to the stage and positioning it where you want it. You can then use the Flash content sprite in much the same way that you use other sprites. When working with Flash content on the Stage, keep these points in mind: • Flash content animation plays only as long as the Flash content sprite is actually on the Stage.
To add Flash to the list of external editors: 1 Select Edit > Preferences > Editors. Note: If you are using a Macintosh OS X operating system, select the Director menu, instead of the Edit menu, to access Preferences. 2 Select Flash, and click Edit. 3 Select Use External Editor, and click Browse. 4 Browse to the location of your Flash application. 5 Select the Flash application file, and click Open. 6 Click OK, and then click OK again. Flash starts when you double click a Flash cast member.
Flipping, rotating, and skewing Flash sprites Lingo or JavaScript syntax can flip, rotate, and skew Flash sprites as the movie plays. For more information, see the Scripting Reference topics in the Director Help Panel. • To flip a Flash sprite, set the flipH and flipV sprite properties. • To skew a Flash sprite, set the skew sprite property. • To rotate a Flash sprite, set the rotation property. Set the obeyScoreRotation property to specify whether a Flash sprite obeys the rotation specified in the Score.
Controlling the Flash content bounding rectangle and registration points You can use Lingo or JavaScript syntax to control the Flash content bounding rectangle and to Flash content registration points. For more information, see the Scripting Reference topics in the Director Help Panel. • To control which part of the Flash content appears within its sprite’s bounding rectangle, set the viewH, viewpoint, viewScale, and viewV properties.
• To determine how much of Flash content is currently streamed, test the percentStreamed property or check the streamSize method. • To set when Director attempts to stream part of Flash content, set the streamMode property. • To clear an error setting for streaming Flash content, use the clearError method. • To determine whether an error occurred while streaming Flash content, use the getError() • • method. To check the current state of a streaming file, test the state property.
Controlling Flash content interactivity with Lingo or JavaScript syntax Lingo or JavaScript syntax can control whether Flash content remains interactive. For more information, see the Scripting Reference topics in the Director Help Panel. • To control whether the actions in Flash content are active, set the actionsEnabled property to TRUE. • To control whether buttons in Flash content are active, set the buttonsEnabled property.
You can also use the following two sprite methods to access ActionScript variables in Flash sprites: getVariable() and setVariable(). For more information, see the Scripting Reference topics in the Director Help Panel. • To return a string that contains the current value of a Flash sprite variable, use the following statement: spriteReference.getVariable("variableName", TRUE) • The parameter TRUE is the default, and is therefore optional.
To handle a message string passed by Flash content: 1 Specify the message string in the Flash content, as described above. For example, in Flash, you could specify the following string as the URL parameter of the getURL function: Hello World In Flash, the ActionScript would look like this: getURL("Hello World"); 2 In Director, include an on getURL handler to receive and read the string passed by the Flash content.
In Flash, the ActionScript would look as follows: getURL("event:alertMessageReceived"); When Director receives the getURL message from the Flash sprite, the Director movie immediately executes the script statement. Sending script statements with arguments It is possible to send script statements that are more complicated than a string or statements that call a single script handler reference.
Sending XML Data from Flash to Director You can send XML data from a Flash sprite or object to a script. To send XML data from a Flash sprite or a global Flash object to a script: 1 On the Flash side, use the XMLobject.send ActionScript method. The XMLobject.send method has a URL and a targetWindow parameter. 2 On the Director side, include an on sendXML handler in your script to handle rhe XML data. This handler takes the same parameters as the XMLobject.
The Flash asset commonPlayer feature gives you the ability to load multiple Flash sprites into one instance of the Flash Player; this provides better Flash playback performance in Director objects that have a great deal of Flash assets. Note: If you do not import any Flash cast members, you must manually add the Flash Asset Xtra to your movie’s Xtra list for global Flash objects to work correctly in Shockwave and projectors.
The callback handler could look like the following: on dirOnStatusHandler (me, aInfoObject) if (aInfoObject[#level] = "error") then member("chat input").text = "Error sending last message." end if end Using the Flash local connection object Flash includes an object type called local connection. The Flash local connection object can be very useful for allowing separate movies on the same computer to connect to and communicate with each other.
Setting up callbacks The next step is to set up callback handlers with the setCallback() method. You should set up a callback for each event you expect the object to generate. Local connection objects generate onStatus and allowDomain events, as well as an event for each incoming message received. These incoming message events are named by the string that is passed as the subject, or first parameter, of the message.
The onStatus event is generated each time the local connection object sends an outgoing message. The myOnStatus handler might look like this: on myOnStatus (me, aInfoObject) if (aInfoObject[#level] = "error") then member("chat input").text = "Error sending last message." else member("chat output").text = member("chat output").text & RETURN & \ member("chat input").text end if end myOnStatus Two arguments are passed with the onStatus event by the local connection object.
Sending messages and closing the connection In order to complete your script, you must finish the beginSprite handler and write handlers for sending messages from the object and closing the connection when you are finished using it. • To finish the beginSprite handler that already contains the newObject() method and all the setCallback() methods, you must add a connect() method. This is actually a Flash ActionScript method that you send to the local connection object you created. pLocalConn.
To create a NetConnection object: • Use the newObject() method. myNetConObject = sprite(1).newObject("NetConnection") To create a NetStream object: • Use the newObject() method and include the NetConnection object as a parameter: myStream = sprite(1).newObject("NetStream", myNetConObject) The NetStream object can send text messages without the need for a Flash sprite on the Stage.
To play a video stream through the video clip object: • Use the attachVideo() method with the reference to the video clip. videoRef.attachVideo(source) For detailed examples of how to use Flash Communication Server in Director, see the Director Support Center (www.macromedia.com/go/director_support). Using the Flash Settings panel When you use a Flash cast member in your Director movie, you may want to display the Flash Settings panel.
4 Click OK. 5 Save your movie. Your Publish Settings are saved with the movie. Once you have disabled the Shockwave context menu, you can attach a mouseUp handler to your Flash sprite that tests for the rightMouseDown property or the controlDown property. In Windows, you can choose just to write an on rightMouseUp handler. The handler might look like the following: on mouseUp if the rightMouseDown or the controlDown then sprite(1).settingsPanel(0) end if end or on rightMouseUp sprite(1).
• Use Lock-Step or Fixed playback mode to adjust the Flash content frame rate. Lock-Step gives • • • • the best performance, because playback of the Flash content is synchronized to the Director movie frame for frame. Set the static property of the sprite to TRUE if your sprite contains no animation (such as a static block of text) and doesn’t overlap other moving Director sprites. This keeps Director from redrawing the sprite every frame unless it moves or changes size.
To place a Director movie cast member in the current movie: 1 Do one of the following: For an internal movie, drag the film loop cast member to the Stage or Score. For a linked external movie, drag the movie cast member to the Stage or Score. 2 Extend the sprite through all the frames in which you want it to appear. 3 To change any of the movie’s properties, use the Movie tab of the Property inspector. See the next section.
9 To determine how the linked movie plays back, set the following options Play Sound enables the sound portion of the linked movie. Turn this option off to mute sounds. Loop replays the linked movie continuously from the beginning to the end and back to the beginning. Enable Scripts makes all the scripts in the linked movie work the same way they do when the movie plays by itself. If you import a Director movie internally, it is imported as a film loop.
4 Set the values for each property in the ActiveX control and then click OK. The ActiveX control now appears in the cast. 5 Drag the ActiveX control from the cast to the Stage. Once the ActiveX control appears on the Stage, it can be repositioned and resized just like any other sprite Xtra. When you pause the movie, the ActiveX control stays in authoring mode and does not react to mouse or keyboard events. When you play the movie, the control responds to user input.
When you insert an ActiveX control in a Director movie, you can view the methods exposed by the control by clicking the Methods tab of the Control Properties dialog box for the ActiveX control. The dialog box displays each method supported by the ActiveX control and a description of the parameters for each method. In Director, all methods that an ActiveX control supports are methods for the corresponding sprite. The generic syntax for calling an ActiveX control method is as follows: ReturnValue = sprite(N).
Using Flash components Macromedia Flash MX 2004 components are bundled movie clips with ActionScript programming interfaces. Director comes with a set of user interface components, including list boxes, radio buttons, check boxes, a scroll pane, and more. You can also add components to the existing set by creating your own in Flash MX 2004 and dragging and dropping them into the Director Components folder.
3 Drag and drop the component you want to a Cast window slot, the Score, or directly to the Stage. Director MX 2004 includes the following Flash components: Button component creates a button that can be customized to include an icon. CheckBox component lets you insert a graphic component that can represent an on or off state. DateChooser component lets you insert a graphic calendar of a month. The calendar shows the current date, and allows the user to navigate to any new day, month, or year.
Setting Flash component parameters Each component has unique parameters that you can set to change its appearance and behavior. A parameter is a property or method that appears in the Property inspector. The most commonly used properties and methods appear as authoring parameters; others must be set using scripting only. After playback has begun, you can get and set parameters on a sprite instance of a Flash component in much the same way that you customize Flash content.
Button component The Button component is a resizable rectangular user interface button. You can add a custom icon to a button. You can also change the behavior of a button from push to toggle. A toggle button stays pressed when clicked and returns to its up state when clicked again. A button can be enabled or disabled in an application. In the disabled state, a button doesn’t receive mouse or keyboard input. An enabled button receives focus if you click it or tab to it.
Property summary for the Button class Method Description Button.label Specifies the text that appears within a button. Button.labelPlacement Specifies the orientation of the label text in relation to an icon. Button.selected When the toggle property is true, specifies whether the button is pressed (true) or not (false). Button.toggle Indicates whether the button behaves as a toggle switch. Event summary for the Button class Method Description Button.
A CheckBox component supports the following Halo styles: Style Description themeColor The background of a component. This is the only color style that doesn’t inherit its value. Possible values are "haloGreen", "haloBlue", and "haloOrange". color The text of a component label. disabledColor The disabled color for text. fontFamily The font name for text. fontSize The point size for the font. fontStyle The font style: either "normal", or "italic".
DataChooser parameters The following are authoring parameters that you can set for each DataChooser component instance in the Property inspector. monthNames sets the month names that are displayed in the heading row of the calendar. The value is an array and the default value is [“January“,“February“,“March“,“April“,“May“,“June“,“July“,“August“,“September“,“October“,“ November“,“December“]. dayNames sets the names of the days of the week.
Property summary for the DateChooser class Method Description DateChooser.dayNames An array indicating the names of the days of the week. DateChooser.disabledDays An array indicating the days of the week that are disabled for all applicable dates in the date chooser. DateChooser.disabledRanges A range of disabled dates or a single disabled date. DateChooser.displayedMonth A number indicating an element in the monthNames array to display in the date chooser. DateChooser.
autoSize indicates how the label sizes and aligns to fit the text. The default value is none. The parameter can be any of the following four values: • none—the label doesn’t resize or align to fit the text. • left—the right and bottom sides of the label resize to fit the text. The left and top sides • • don’t resize. center—the bottom side of the label resizes to fit the text. The horizontal center of the label stays anchored at the its original horizontal center position.
List component The List component is a scrollable single- or multiple-selection list box. A list can also display graphics, including other components. The List component uses a zero-based index, where the item with index 0 is the top item displayed. When adding, removing, or replacing list items using the List class methods and properties, you may need to specify the index of the list item. You can set up a list so that users can make either single or multiple selections.
A List component uses the following Halo styles: Style Description alternatingRowColors Specifies colors for rows in an alternating pattern. The value can be an array of two or more colors, for example, 0xFF00FF, 0xCC6699, and 0x996699. backgroundColor The background color of the list. This style is defined on a class style declaration, ScrollSelectList. borderColor The black section of a three-dimensional border or the color section of a two-dimensional border. borderStyle The bounding box style.
Property summary for the List class Property Description List.cellRenderer Assigns the class or symbol to use to display each row of the list. List.dataProvider The source of the list items. List.hPosition The horizontal position of the list. List.hScrollPolicy Indicates whether the horizontal scroll bar is displayed ("on") or not ("off"). List.iconField A field within each item to be used to specify icons. List.iconFunction A function that determines which icon to use. List.
Using the NumericStepper component The NumericStepper can be used anywhere you want a user to select a numeric value. For example, you could use a NumericStepper component in a form to allow a user to set their credit card expiration date. In another example, you could use a NumericStepper to allow a user to increase or decrease a font size. NumericStepper parameters The following are authoring parameters that you can set for each NumericStepper component instance in the Property inspector.
Style Description textDecoration The text decoration; either "none", or "underline". textAlign The text alignment; either "left", "right", or "center". Property summary for the NumericStepper class Property Description NumericStepper.maximum A number indicating the maximum range value. NumericStepper.minimum A number indicating the minimum range value. NumericStepper.nextValue A number indicating the next sequential value. This property is read-only. NumericStepper.
Customizing the RadioButton component You can transform a RadioButton component horizontally and vertically both while authoring and at runtime. The bounding box of a RadioButton component is invisible and also designates the hit area for the component. If you increase the size of the component, you also increase the size of the hit area. If the component’s bounding box is too small to fit the component label, the label clips to fit.
Event summary for the RadioButton class Event Description RadioButton.click Triggered when the mouse is pressed over a button instance. ScrollPane component The Scroll Pane component displays movie clips, JPEG files, and SWF files in a scrollable area. You can enable scroll bars to display images in a limited area. You can display content that is loaded from a local location, or from over the internet. You can set the content for the scroll pane both while authoring and at runtime using scripts.
Method summary for the ScrollPane class Method Description ScrollPane.getBytesLoaded() Returns the number of bytes of content loaded. ScrollPane.getBytesTotal() Returns the total number of content bytes to be loaded. ScrollPane.refreshPane() Reloads the contents of the scroll pane. Property summary for the ScrollPane class Method Description ScrollPane.content A reference to the content loaded into the scroll pane. ScrollPane.
TextArea component You can use a TextArea component wherever you need a multiline text field. If you need a singleline text field, use the “TextInput component” on page 225. For example, you could use a TextArea component as a comment field in a form. You could set up a listener that checks if field is empty when a user tabs out of the field. That listener could display an error message indicating that a comment must be entered in the field.
Property summary for the TextArea class Property Description TextArea.editable A Boolean value indicating whether the field is editable (true) or not (false). TextArea.hPosition Defines the horizontal position of the text within the scroll pane. TextArea.hScrollPolicy Indicates whether the horizontal scroll bar is always on ("on"), never on ("off"), or turns on when needed ("auto").S TextArea.html A flag that indicates whether the text field can be formatted with HTML. TextArea.
TextInput component parameters The following are authoring parameters that you can set for each TextInput component instance in the Property inspector or in the Component Inspector panel: text specified the contents of the TextInput. You cannot enter carriage returns in the Property inspector or Component Inspector panel. The default value is "" (empty string). editable indicates whether the TextInput component is editable (true) or not (false). The default value is true.
Property Description TextInput.maxChars The maximum number of characters that a user can enter in a TextInput text field. TextInput.maxHPosition The maximum possible value for TextField.hPosition. This property is read-only. TextInput.password A Boolean value that indicates whether or not the input text field is a password field that hides the entered characters. TextInput.restrict Indicates which characters a user can enter in a text field. TextInput.
Key Description Control Allows multiple noncontiguous selections. Shift Allows multiple contiguous selections. The Tree component can be used to represent hierarchical data such as e-mail client folders, file browser panes, or category browsing systems for inventory. Most often, the data for a tree is retrieved from a server in the form of XML, but it can also be well-formed XML that is created while authoring in Director.
When a Tree displays a node it uses the label attribute of the node by default as the text label. If any other attributes exist, they become additional properties of the node’s attributes within the Tree. The actual root node is interpreted as the Tree component itself. This means that the firstChild (in the sample, ), is rendered as the root node in the Tree view. This means that a tree can have multiple root folders.
Method Description Tree.setIcon() Specifies whether a node is open or closed. Tree.setIsOpen() Specifies a symbol to be used as an icon for a node. Property summary for the Tree class Property Description Alert.cancelLabel Specifies an XML data source. Alert.noLabel Specifies the first node at the top of the display. Alert.okLabel Specifies the selected node in a tree instance. Tree.selectedNode Specifies the selected nodes in a tree instance.
CHAPTER 10 Sound and Synchronization You can give your movie added appeal by including a sound track, a voice-over, ambient noises, or other sounds. With Macromedia Director MX 2004, you can control when sounds start and stop, how long they last, their quality and volume, and several other effects. Using Macromedia Shockwave Audio, you can compress sounds for easier distribution and stream them from an Internet source. You can also incorporate Windows Media Audio (WMA) in your Director movies.
Director does not store sound data in a linked sound cast member. Instead, it keeps a reference to a sound file’s location and imports the sound data each time the sound begins playing. Because the sound is never entirely loaded into RAM, the movie uses memory more efficiently. Also, Director streams many sounds, which means it begins playing the sound while the rest of the sound continues to load from its source, whether on disk or over the Internet.
5 Click the Member tab in the Property inspector. The following noneditable settings appear: ■ The cast member size in kilobytes ■ The cast member creation and edit dates ■ The name of the last person who modified the cast member 6 To view or edit the cast member name, use the Name text box. 7 To change the external sound file to which the cast member is linked (if it has been imported as a Linked to External File sound), enter a new path and file in the Filename text box.
3 Extend the sound through as many frames as necessary. New sounds are assigned the same number of frames as set for sprites in the Sprite Preferences dialog box. You might need to adjust the number of frames to make the sound play completely or change a tempo setting to make the playhead wait for the sound to finish. For more information, see “Synchronizing media” on page 240.
Playing sounds with Lingo or JavaScript syntax Lingo or JavaScript syntax lets you play and control sounds regardless of the settings in the Score. You can use these scripts to play sounds, turn them on and off, and play external sounds that aren’t cast members. Using script to play sounds lets you control the exact timing of when sounds start and stop. Lingo or JavaScript syntax also lets you play only part of a sound cast member or play several sounds in succession without interruption.
After queuing sounds, you can still control whether the queue is obeyed. You can select to interrupt loops with the breakLoop() method or to pause playback with the pause() method. The playNext() method lets you skip immediately to the next sound in the queue. For more information about sound methods, see the Director Scripting Reference. Playing external sound files In addition to playing sounds you have imported as cast members, you can also play external sound files that have not been imported.
About Shockwave Audio Shockwave Audio is a technology that makes sounds smaller and plays them faster from disk or over the Internet. Shockwave Audio can compress the size of sounds by a ratio of up to 176:1 and is streamable, which means Director doesn’t have to load the entire sound into RAM before it begins playing. Director starts to play the beginning of the sound while the rest of the sound is still streaming from its source, which can be from a disk or over the Internet.
When you distribute a movie that contains sounds compressed with Shockwave Audio, the SWA Decompression Xtra is already included in the Macromedia Shockwave Player. If you compress sounds in Shockwave format in a projector, you must provide the SWA Decompression Xtra for the projector. To have Director compress internal sound cast members when you create a projector, save a movie as Shockwave, or update the movie: 1 Select File > Publish Settings. 2 Select the Shockwave tab.
4 Drag the Shockwave Audio cast member to a sprite channel (not one of the sound channels) to create a sprite. Extend the sprite through all frames in which the sound should play, or use the tempo channel to make the movie wait for the end of the sound. For more information, see “Synchronizing media” on page 240. You can’t place streaming audio cast members in the sound channels. The sound streams from the source location when the movie plays.
Synchronizing media To pause the playhead until a specified cue point in a sound or digital video is reached, you can use the Wait for Cue Point option in the Tempo dialog box. You can also use this method to wait for the end of the sound or digital video, even if it has no cue points. Cue points can also be used to trigger events that scripts can interpret. For more information, see “Synchronizing sound with Lingo or JavaScript syntax” on page 241.
Synchronizing sound with Lingo or JavaScript syntax By writing script that performs an action when a cue point is reached in a sound or QuickTime file, you can synchronize a movie with sound or digital video. For more information about the following methods and properties, see the Scripting Reference topics in the Director Help Panel. • To set up script that runs when the movie reaches a cue point in a sound or QuickTime file, • • • • put the script in an on cuePassed handler.
Chapter 10: Sound and Synchronization
CHAPTER 11 Using Digital Video You can give your Macromedia Director MX 2004 movie added appeal by including digital video. Digital video not only offers high-quality real-time image animation and sound, but also supports new types of media such as Windows Media audio and video files and DVD content. Director supports QuickTime video and Real Media content for Windows and Macintosh. Director also supports Windows Media Video and Audio (WMV and WMA) for Windows only.
• Control QuickTime VR • Trigger events at key points in time for a video sprite's playback Note: You can export movies or portions of movies as QuickTime or AVI videos. For more information, see “Exporting digital video and frame-by-frame bitmaps” on page 465. About digital video formats When you import Windows Media, DVD content files, AVI, QuickTime, or RealMedia, the cast members you create always remain linked to the original external file, even if you select the Standard Import option.
Using the video windows Whether a digital video is a cast member or a sprite on the Stage, you can preview it in its corresponding video window. There are different versions of the window for QuickTime, Windows Media, DVD, RealMedia, and AVI digital content.
4 If the cast member or sprite is a QuickTime video, select one of the following Playback options: Sync to Soundtrack makes the digital video skip frames (if necessary) to keep up with its soundtrack. The digital video might also take less time to play. Play Every Frame makes every frame of the digital video appear but does not play the soundtrack because the video cannot play the soundtrack asynchronously while the video portion plays frame by frame.
Playing digital video with Lingo or JavaScript syntax Lingo or JavaScript syntax can take advantage of the most important and powerful features of digital video. Besides playing digital video linearly, Lingo or JavaScript syntax can pause, stop, and rewind a video. These abilities are useful for jumping to segments within a digital video and for emulating a typical digital video control panel.
• To determine the stop time of a track in a digital video sprite or cast member, check the digital video’s trackStopTime sprite or cast member property. • To determine whether a sprite’s track is enabled to play, check the digital video’s trackEnabled • • • sprite property. To obtain the text at the current time from a text track in a digital video sprite, check the digital video’s trackText sprite property.
7 To determine how a movie image appears within the sprite bounding rectangle when the movie is rotated, scaled, or offset, set the following Framing options: Crop displays the movie image at its default size. Any portions that extend beyond the sprite’s rectangle are not visible. For more information, see “Cropping digital video” on page 257. Center is available only if Crop is selected.
Controlling QuickTime with Lingo or JavaScript syntax You can use Lingo or JavaScript syntax to control a QuickTime video’s appearance and sound volume. For QuickTime VR, you can use Lingo or JavaScript syntax to pan a QuickTime VR digital video and specify what happens when the user clicks or rolls over portions of the video. You can set the rotation, scale, and translation properties for either a QuickTime cast member or a sprite.
• To determine the name of the handler that runs when the pointer leaves a QuickTime VR hotspot that is visible on the Stage, set the hotSpotExitCallback property. • To specify the ID of the current node that a QuickTime VR sprite displays, set the node • • • QuickTime VR sprite property. To specify the name of the handler that runs after the QuickTime VR sprite switches to a new active node on the Stage, set the nodeEnterCallback QuickTime VR sprite property.
Using Windows Media files in Director Director now fully supports Windows Media Video and Audio formats. Windows Media format is a high-quality, secure, and comprehensive digital media format available for streaming and download-and-play applications on Windows systems, set-top boxes, and portable devices. Windows Media format comprises Windows Media Audio and Video codecs, an optional integrated digital rights management (DRM) system, and a file container.
4 In the Filename text box, choose the file to be associated with the cast member. You can type the name of the file, or browse for the file by clicking the “…” button. 5 In the Name text box, type a name for the new Windows Media cast member. Setting Windows Media properties You can set Windows Media properties that determine the cast member name, how it is displayed in your movie, whether audio or video in the sprites created from the Windows Media cast member are on or off, and more.
Using the Windows Media video window The Windows Media window lets you preview Windows Media audio and video files. You can also control Windows Media sprites using the this window. For more information, see “Controlling Windows Media sprites using Lingo or JavaScript syntax” on page 254. To use the Windows Media window: • Double-click a Windows Media cast member or sprite. The Windows Media window appears. This window provides controls to play, stop, pause, rewind, and fast forward the movie.
Linking to DVD media content You can link to DVD media content by using the Insert menu or the DVD Editor, or you can use scripting to set the folder property value. Setting the folder property will allow Director to play DVDs from the hard drive or from the relative location of a movie/projector.
Issues with Macintosh DVD folder pathnames On Macintosh computers, the format of the pathname for the folder property should use a forward slash ( / ) as the path’s delimeter, instead of the standard Macintosh delimiter colon ( : ). In addition, /volumes/ should be concatenated at the start of the pathname of the DVD folder. For example, if the DVD folder is located on the root of the boot drive, it would look like the following: member (2).
Setting DVD Cast member properties The DVD Property inspector lets you set the options for audio, close captioning, volume and whether or not the cast member pauses during playing. To set DVD cast member properties: 1 Select a DVD cast member on the stage or in the cast window. 2 Select Window > Property Inspector and click on the DVD tab. 3 In Graphical view, set the following properties: Audio, Closed Captions, Paused, and Volume.
6 Go to the Stage and drag any of the handles that appear on the selection rectangle that surrounds the video image. Director displays only as much of the movie image as can fit in the area that is defined by the selection rectangle. If you would rather scale the movie than resize it, select Scale instead of Crop on the QuickTime tab in the Property inspector. Director scales the movie if you resize the bounding rectangle.
When you use streaming digital video in a movie that is distributed on the Internet, remember the following points: • The video begins to play immediately unless the member’s pausedAtStart property is set to TRUE or the controller member property is set to TRUE. • After a digital video begins to download, the download continues until it is finished, even if the sprite no longer appears on the Stage. Use the percentStreamed QuickTime sprite property to test how much of the media has been downloaded.
System requirements To create Shockwave movies containing RealMedia content, the following must be installed: • Director MX, which includes the Xtra for RealMedia. • RealPlayer 8 or RealOne Player. (RealNetworks products are available for download at www.real.com.) To view Shockwave content containing RealMedia content, the following software must be installed: • The Shockwave Player. • RealPlayer 8 or RealOne Player.
RealMedia sample file If you have RealOne Player or RealPlayer 8 installed on your system and are familiar with Director, viewing and using RealMedia files in Director is incredibly quick and easy. Before you begin reading this document, please view the RealMedia sample file included on the Director MX CD or the videotest.rm file included in the RealPlayer program installation folder. To view the sample file: 1 Start Director. 2 Select File > Import.
You can have as many RealMedia streams and cast members in your Director movie as you want, as long as you play them consecutively, not concurrently. This version of Director does not support playing multiple RealMedia cast members at the same time. RealMedia video The RealVideo portion of your RealMedia file is rendered offscreen, and there is no direct-toStage option. This means that you can layer other sprites on top of your RealMedia sprite.
RealMedia stream playback In Director, RealMedia playback occurs at the cast member level, not the sprite level. Therefore, if you have two sprites of a cast member, and you apply a method or property to one of the sprites, the method applies to both sprites.
Authoring tips Review the following guidelines before you begin creating RealMedia cast members and assembling your movie. • Whenever possible, refer to sprites rather than cast members in Lingo or JavaScript syntax. • • • • Because future versions of Director may enable sprite-level playback of RealMedia cast members, referring to sprites may help ensure that your movies are forward-compatible with Director.
To create a RealMedia cast member using Insert > Media Element: 1 Select Insert > Media Element > RealMedia. 2 On the Member tab in the Property inspector, enter the name of the RealMedia cast member and enter the URL, or use the “...” button to browse to the location of a local RealMedia file. 3 Use the options on the RealMedia tab in the Property inspector to specify the properties of the cast member. For more information, see “The RealMedia tab in the Property inspector” on page 267.
Obtaining dynamic RealMedia cast member properties When a RealMedia cast member is initially created, the values that are listed in the Property inspector for the dynamic properties—height, width, rect, and duration—are placeholder values. After you play the cast member on the Stage or in the RealMedia viewer, the actual values for the properties are saved and appear in the Property inspector. When you save the movie, these values are saved with the cast member.
The RealMedia tab in the Property inspector The RealMedia tab in the Property inspector displays the properties of RealMedia cast members. To set or change the editable properties, you can use the Property inspector or the script properties for RealMedia. Even if you are not planning to use the script properties, it is a good idea to read the script entries for the properties that appear in the Property inspector because they contain valuable information.
• • userName (RealMedia) lets you specify a user name if the cast member references a protected URL. For security purposes, after a user name has been entered, it cannot be retrieved. If this property has been set, the value that appears in the Property inspector is ********. password allows you to specify a password if the cast member references a protected URL. For security purposes, after a password has been entered, it cannot be retrieved.
RealMedia Slider Knob lets a graphic sprite function as a slider to control and monitor the playback location (current time) of the RealMedia sprite with the RealMedia Target behavior attached. When the user drags a sprite that has this behavior attached, a seek action is performed on the stream. RealMedia Buffering Indicator lets a text area or field provide a graphical display of the streambuffering progress of the RealMedia sprite with the RealMedia Target behavior attached.
7 Create a field on the Stage to display playback information about the RealMedia sprite similar to the information that appears in the status bar of the RealMedia viewer. 8 Drag the RealMedia Stream Information behavior to the field; then select the type of information you want to display and the group that the behavior belongs to in the Parameters dialog box. You can create as many of these features as you like.
Previous Cast Member (left arrow) lets you view the previous RealMedia cast member (in the current cast) in the viewer. Play initiates the streaming process for the current RealMedia cast member. For more information about the streaming process, see the state (RealMedia) property in the Scripting Reference topics in the Director Help Panel. Rewind stops playback, empties the stream buffer, and resets the stream to the beginning. This is equivalent to the stop (RealMedia) method in script.
To add the Xtra for RealMedia to your movie: 1 Select Modify > Movie > Xtras to display the Movie Xtras dialog box. 2 Select RealMedia Asset.x32 in the list. If RealMedia Asset.x32 does not appear in the list, click the Add button, and select it in the Add Xtras dialog box. 3 Select the Include in Projector and Download if Needed options. 4 Click OK.
Unsupported sound elements The following Lingo or JavaScript syntax elements are not supported for RealMedia cast members or for sound channels playing the audio portion of a RealMedia stream: • • • • • • • • • • • • • • • • breakLoop() channelCount endTime getPlayList() loopCount loopEndTime loopsRemaining loopStartTime play() playFile() playNext() queue() rewind() sampleCount setPlayList() (Use the state (RealMedia) or mediaStatus RealMedia cast member properties instead.
Chapter 11: Using Digital Video
CHAPTER 12 Behaviors A behavior in Macromedia Director MX 2004 is prewritten Lingo or JavaScript syntax that you use to provide interactivity and add interesting effects to your movie. You drag a behavior from the Library palette and drop it on a sprite or frame to attach it. If the behavior includes parameters, a dialog box appears that lets you define those parameters. For example, most navigation behaviors let you specify a frame to jump to.
To attach a behavior to a single sprite or frame using the Library palette: 1 Select Window > Library Palette. 2 Select a library from the Library pop-up menu in the upper left corner of the palette. 3 To view a brief description of included behaviors, move the pointer over a behavior icon. If the behavior includes a longer description, you can view it in the Behavior inspector or in Director Help. For more information, see “Getting information about behaviors” on page 278.
5 To attach a behavior to a frame in the behavior channel, drag a behavior from the Library palette to a frame in the behavior channel. 6 Enter parameters for the behavior in the Parameters dialog box. Note: If you attach a behavior from a Director library of behaviors, the behavior is copied to the currently active cast. To attach the same behavior to several sprites at once using the Library palette: • Select the sprites on the Stage or in the Score and drag a behavior to any one of them.
Changing the order of attached behaviors Director executes behaviors in the order they were attached to a sprite, and they are listed in this order in the Property inspector and Behavior inspector. It is sometimes necessary to change the sequence of behaviors so that actions occur in the proper order. To change the order of the behaviors attached to a sprite: 1 Select the sprite in the Score or on the Stage. 2 Open the Behavior inspector or click the Behavior tab in the Property inspector.
Creating and modifying behaviors Without any scripting or programming experience, you can use the Behavior inspector to create and modify behaviors to perform basic actions. To create behaviors with more complex structures, you must understand scripting in Lingo or JavaScript syntax. Using the Behavior inspector is a good way to learn Lingo or JavaScript syntax. You can examine the scripts created by the Behavior inspector to see how basic functions are assembled.
You can choose as many actions as you need for a single event. ■ To change an existing event or action group, select an event from the list and then add or remove actions in the Actions list. ■ To delete an event or action group, select the event and press Delete. ■ To change the sequence of actions in an event or action group, select an event from the Events list, select an action from the Actions list, and then click the up and down arrows above the Actions list to change the order of actions.
Go to Marker moves the playhead to the specified marker. Go to Net Page goes to the specified URL. Wait on Current Frame waits at the current frame until another behavior or script advances to the next frame. Wait until Click waits at the current frame until the mouse button is clicked. Wait until Key Press waits at the current frame until a key is pressed. Wait for Time Duration Play Cast Member Play External File Beep waits at the current frame for the specified time.
• The behavior can have parameters that users edit from the Parameters dialog box. The optional • • on getPropertyDescriptionList handler sets up the Parameters dialog box. For more information, see the Scripting Reference topics in the Director Help Panel. A description of the behavior can be added to the Behavior inspector. The optional on getBehaviorDescription handler displays a description of the behavior in the Behavior inspector.
Customizing a behavior’s property If a behavior’s script includes an on getPropertyDescriptionList handler, Director lets users set the property’s initial values from the Parameters dialog box.
• specifies a range of possible values that the user can assign to the property. Specify the possible values as a list. To specify a range between a minimum and maximum number, use the form [#min:minimum, #max:maximum]. The example sets the range from 1 to 10. When the range is between a maximum or minimum number, the Parameters dialog box provides a slider that sets the value. To specify no range, omit the #range parameter.
// JavaScript syntax function getPropertyDescriptionList() { var description = new Array(); description[#movement] = [:] description[#movement][#default] = 5 description[#movement][#format] = #integer description[#movement][#comment] = "Set motion to the right:" description[#movement][#range] = [#min:1, #max:10] description[#noise] = [:] description[#noise][#default] = "" description[#noise][#format] = #sound description[#noise][#comment] = "Sound cast member name" return description } Including a descript
description = [:] description[#movement] = \ [#default: 5, \ #format:#integer, \ #comment: "Set motion to the right:", \ #range: [#min:1, #max:10] \ ] description[#noise] = \ [#default:"", \ #format: #sound, \ #comment:"Sound cast member name" \ ] return description end // JavaScript syntax function enterFrame() { if (sprite(spriteNum).locH > _movie.stageRight) { sprite(spriteNum).locH = _movie.stageLeft } else { sprite(spriteNum).locH += movement } } function mouseUp() { sprite(spriteNum).foreColor = Math.
Sending messages to behaviors attached to sprites Script can run handlers in behaviors attached to specific sprites by sending messages to the behaviors attached to one sprite, all sprites, or several specific sprites. Sending messages to a sprite The sendSprite method sends a message to a specified sprite. If none of the sprite’s behaviors has a handler that corresponds to the message, the message passes to the cast member script, the frame script, and then the movie script.
Sending messages to specific behaviors only The call method sends an event to specific behaviors. Unlike the sendSprite method, the call method does not pass the message to frame scripts, scripts of the cast member, or movie scripts. Before sending a message to a specific behavior, check the scriptInstanceList sprite property to find a behavior script reference to use with the call method.
Using inheritance in behaviors Behaviors can have ancestor scripts in the same way that parent scripts do. (Ancestor scripts are additional scripts whose handlers and properties a parent script can call on and use.) • The ancestor’s handlers and properties are available to the behavior. • If a behavior has the same handler or property as an ancestor script, then the script uses the property or handler in the behavior instead of the one in the ancestor.
Chapter 12: Behaviors
CHAPTER 13 Navigation and User Interaction Adding interactivity lets you involve your audience in your Macromedia Director MX 2004 movies. Using the keyboard, the mouse, or both, your audience can download content from the Internet, jump to different parts of movies, enter information, move objects, click buttons, and perform many other interactive operations. Unless made to do otherwise, a movie plays through every frame in the Score from start to finish.
To use basic navigation behaviors: 1 Create a movie that contains a sprite in frame 1 and at least one marker in a later frame. 2 Select Window > Library Palette, and select the Navigation library. 3 Drag Hold on Current Frame to frame 1 in the script channel. 4 5 6 7 8 Typically, you use this behavior in a frame that requires user interaction such as selecting a menu command. Play the movie. The playhead remains in frame 1 where you attached the behavior.
Jumping to locations with Lingo or JavaScript syntax The Lingo or JavaScript syntax navigation features can make a movie jump to other frames, to other movies, or to Internet movies and web pages. You can also use script to make a movie appear to pause by looping in one frame or a group of frames. For more information about specifying the locations of frames, markers, and movies in Lingo and JavaScript syntax, see the Scripting Reference topics in the Director Help Panel.
Jumping away and returning to the original location You might want a movie to jump to a different frame or a separate movie and then return to the original frame. For example, at a website that describes the weather, you could jump to a movie segment that explains a weather term and then return to the original location. To jump away and return to the original location: • Use the and play done methods. The play method branches a movie to another frame, another movie, or a specified frame in another movie.
Making sprites editable and draggable Using the Property inspector, you can make a sprite editable, draggable, or both while your movie is running. For more information, see “Displaying and editing sprite properties in the Property inspector” on page 59. To make a sprite draggable on the Stage: • Click the Moveable button in the Property inspector. To make a text sprite editable: • Click the Editable button in the Property inspector.
Checking which text is under the pointer with Lingo or JavaScript syntax Lingo or JavaScript syntax can detect which text component in a text or field cast member is currently under the mouse pointer. For more information, see the Scripting Reference topics in the Director Help Panel. Use script that applies to text and field cast members as follows: • To detect which character in a text or field cast member is under the pointer, use the pointToChar() method.
• To set up script that runs when the mouse pointer is within a sprite’s bounding rectangle when • the playhead enters the frame that contains the sprite, place the script in an on mouseWithin event handler. The mouseWithin event can occur repeatedly as long as the mouse pointer remains inside the sprite. To determine whether the cursor is over a specific sprite, use the rollOver() method.
Equivalent cross-platform keys Because of inherent differences between Windows and Macintosh keyboards, keys on Windows and Macintosh computers don’t always correspond directly. This discrepancy can create confusion because script often uses the same term to refer to corresponding keys on Windows and Macintosh computers, even though the key’s name differs on the two platforms. The following table lists script elements that refer to specific keys and the keys they represent on each platform.
Xtra extensions that support animated cursors The Director installation program places two animated color cursor files in the Media Support folder within the Director application’s Xtras folder. The specific files depend on the platform you are using. Windows PowerPC Purpose Cursor Options.x32 Cursor Options This file supports the creation of cursors while you author movies in Director. Do not distribute this file with projectors; it is not licensed for redistribution. Cursor Asset.
To create an animated color cursor cast member: 1 Select Insert > Media Element > Cursor. Director opens the Cursor Properties Editor, which you use to set up the cursor. 2 From the Cast pop-up menu, select the cast that contains the cast member you want to add as 3 4 5 6 a frame in your cursor. The cast members used for a single cursor can be stored in different casts. Use the < and > buttons to find the cast member you want.
Using an animated color cursor in a movie After you add an animated color cursor to the cast, use script to switch to the animated cursor as you would any other cursor. You can set up an animated cursor as the movie’s cursor or a sprite’s cursor. To switch to an animated color cursor, use the following method: cursor (member whichCursorCastMember) For whichCursorCastMember, substitute a cast member name (surrounded by quotation marks) or a cast member number.
Chapter 13: Navigation and User Interaction
CHAPTER 14 3D Basics Macromedia Director MX 2004 lets you bring robust, high-performance 3D graphics to the web. With Director, you can develop a wide spectrum of 3D productions, ranging from simple text handling to interactive product demonstrations to complete immersive game environments. Using Macromedia Shockwave Player, users can view your work on the web with Netscape Navigator, Microsoft Internet Explorer, or other Shockwave-supported browsers.
About 3D in Director MX 2004 The following are the main components that are common between Director MX 2004 and earlier versions of Director: • The Stage is the authoring area in which the Director movie is assembled. • The Score displays the arrangement of channels that organize, display, and control the movie • • • over time. Because 3D is primarily script-controlled, it involves much less direct manipulation in the Score than other Director features.
• The Behavior inspector lets you create and modify behaviors. • • For an introduction to the Behavior inspector, see “3D behaviors” on page 312. For a full discussion, see “Using 3D behaviors” on page 327. Director provides easy but powerful 3D text handling. For more information, see “Creating 3D text” on page 324. Lingo and JavaScript syntax are the Director scripting languages. They can be used to create movies that are more complex and interactive.
Using the Shockwave 3D window The Shockwave 3D window provides an easy way for you to inspect a 3D cast member. Some properties of 3D cast members can also be edited in this window. To use the Shockwave 3D window: 1 Select a 3D cast member in the cast. 2 Click the Shockwave 3D Window button on the Director toolbar. The Shockwave 3D window appears, displaying the 3D cast member currently selected in the cast.
3 Use the following controls: ■ The camera buttons along the side—Dolly, Rotate, and Pan—let you change your viewing angle by zooming in and out, moving around the world origin, and moving in a straight line horizontally or vertically, respectively. Hold the Shift key while using these tools to make the camera move faster. Dolly Camera Rotate Camera Pan Camera ■ The two buttons below the camera buttons let you control whether the y-axis or the z-axis is the up axis when using the Camera Rotate tool.
Using the Property inspector for 3D With the Property inspector, you can modify the 3D cast member without using script. The 3D Model tab of the Property inspector offers a simple way to view and control numerous aspects of the 3D world. To view the 3D Model tab: 1 Open the Cast window if it isn’t already open. 2 Click the 3D cast member you want to select. 3 Click the Property inspector button in the toolbar. The Property inspector opens. 4 Click the 3D Model tab in the Property inspector.
• The Director Light area lets you select one of ten lighting positions to apply to a single • directional light. You can also adjust the color for the ambient light. (Directional light comes from a particular, recognizable direction; ambient light is diffuse light that illuminates the entire scene.) Finally, you can adjust the background color of the scene. The Shader Texture area lets you work with shaders and textures.
To choose a rendering method: 1 Select the Stage. 2 Open the Property inspector. 3 Click the Movie tab. 4 Select a rendering method from the pop-up menu. If you don’t select a rendering method, Director defaults to #auto. Below the pop-up menu, the name of the active 3D renderer property appears. The value of this property indicates which rendering method is currently being used. This is especially useful when you want to know which renderer is active while you have #auto selected.
Determining whether anti-aliasing is supported Not all 3D renderers can perform the additional calculations that anti-aliasing requires. If you have a 3D sprite that you want to anti-alias, check first that the 3D renderer supports anti-aliasing. The renderers that currently support anti-aliasing include the Director software renderer, and DirectX 5.2 and DirectX 7.0.
end on mouseUp -- stop animation -- the interaction/animation has ended so turn -- anti-aliasing ON sprite(1).antiAliasingEnabled = TRUE end // JavaScript syntax function mouseDown() { // user interaction/animation is about to start so turn // anti-aliasing OFF sprite(1).antiAliasingEnabled = false; //start animation } function mouseUp() { // stop animation // the interaction/animation has ended so turn // anti-aliasing ON sprite(1).
The 3D world This section provides a brief overview of the contents of 3D cast members. For more detailed information, see “About the 3D cast member” on page 315. Each 3D cast member contains a complete 3D world. It can contain models (the objects that viewers see within the world) that are illuminated by lights and viewed by cameras. A sprite of a 3D cast member represents a specific camera’s view into the world.
Lights and cameras Lights are used to light the 3D world. Without lights, the objects within the world can’t be seen. Although lights control the appearance of the 3D world, cameras control how a sprite views the 3D world. A 3D sprite displays a particular camera’s view into the world. For more information, see “About lights and cameras” on page 382. Groups A group is a node that has no geometry, used for grouping models, lights, and cameras together so they can be treated as a single unit.
CHAPTER 15 The 3D Cast Member, 3D Text, and 3D Behaviors Several Macromedia Director MX 2004 features let you create a 3D movie: • A 3D cast member contains a complex internal structure that includes model resources, models, lights, and cameras. Each of these objects has its own array of properties. • Director lets you convert 2D text to 3D and then work with the 3D text as you would with • any other 3D cast member.
• Cameras are views into the 3D cast member. Each sprite that uses a given cast member can • display the view from a different camera. For more information about sprites, see Chapter 14, “3D Basics,” on page 303. Groups are clusters of models, lights, and/or cameras that are associated with one another. This makes moving the associated items much easier; rather than moving each item separately, you can write Lingo or JavaScript syntax that moves the group with a single command.
The following cast member methods and properties perform basic model resource operations: Method Function Returns modelResource. count Returns the number of model resource objects included in the cast member. Integer. modelResource(name) Returns the model resource named name. Returns the model resource object named name, if it exists. Returns void if the object does not exist. modelResource[index Returns the model resource at the ] designated position in the index.
Models The models in a cast member are the actual visible objects that are seen in the 3D cast member. Models move according to the motions you assign to them in your 3D modeling software, and according to animation scripts that you write. Their movement results from repositioning and reorienting their geometries in 3D space. The following cast member methods and properties can be used to perform basic model operations: Method Function Returns model.
Method Function Returns model(name1). cloneDeep(name2) Creates a copy of the model named name1 and assigns it the name name2. The new model uses a copy of the original model’s model resource and shader; changes to the original model’s model resource and shader have no effect on the new model. Returns the model named name2. cloneModelFromCast Copies the model named name2 (from the Returns the model named Member(name1, name2, member named name3) into the current name1. member.
Method Function Returns deleteShader (name) Deletes the shader named name. Script references to this shader persist but can do nothing. TRUE (1) if the shader named name exists. FALSE (0) if the shader named name doesn’t exist. deleteShader (index) Deletes the shader with the given index number. Script references to this shader persist but can do nothing. TRUE (1) if the shader with this index number exists. FALSE (0) if the shader with this index number doesn’t exist.
Motions A motion is an animation of a model. Motions can be shared by multiple models. A 3D cast member contains a palette of motions that are available to any model in the world. The following cast member methods and properties can be used to perform basic motion operations: Method Function Returns motion.count Returns the number of motion objects included in the cast member. Integer. motion(name) Returns the motion named name. Returns the motion object named name if it exists.
The following methods and properties can be used to perform basic light operations: Method Function light.count Returns Returns the number of light objects included Integer. in the cast member. light(name) Returns the light named name. light[index] Returns the light at the designated position in Returns the light object at that index number if it exists. the index. The index number can change if Returns void if the object does lights are added or deleted. not exist at that index number.
Method Function Returns deleteCamera (name) Deletes the camera named name. Script references to this camera persist but can do nothing. TRUE (1) if the camera named name exists. FALSE (0) if the camera named name doesn’t exist. deleteCamera (index) Deletes the camera with the given index number. Script references to this camera persist but can do nothing. TRUE (1) if the camera with this index number exists. FALSE (0) if the camera with this index number doesn’t exist.
Creating 3D text To create 3D text, you first create 2D text, and then you convert the text to 3D. Note: Alternatively, you can use the extrude3d() method of a 3D cast member to create an extrudedtext model resource in the cast member. To create 3D text: 1 Select Window > Text to open the text editor. 2 Select the desired font, size, style, and alignment. 3 4 5 6 7 Most standard fonts work well with 3D text. You might need to experiment to get specific results. Enter the text.
3 Select from among the Front Face, Back Face, and Tunnel check boxes. These options control which sides of the text appear. 4 Set the smoothness. 5 6 7 8 9 This determines the number of polygons that are used to construct the text. The more polygons that are used, the smoother the text appears. Set the tunnel depth. This is the length of the tunnel from the front face to the back face. Select a beveled edge type. Beveling makes the edges of the 3D letters appear rounded or angled.
Exceptions The following methods and properties work differently when used with 3D text.
These properties can be set while the text is in 2D mode. They have no visible effect until the text appears in 3D mode. When you access the properties listed in the following table for an extruded 3D text model that you created by using the extrude3D method, you must refer to the model resource of the text. The Lingo syntax for this is shown in the following example: member(whichMember).model[modelIndex].resource.
Behavior types Director provides two types of 3D behaviors: trigger and action. Action behaviors are divided into three types: local, public, and independent. These behavior types and subtypes are defined in the following table.
The following table describes the available triggers. Name Description Mouse Left Triggers action when the user presses, holds down, or releases the left mouse button (Windows) or the mouse button (Macintosh). Mouse Right Triggers action when user presses, holds down, or releases the right mouse button. To use on the Macintosh, you must set the emulateMultibuttonMouse property to true; then Control-click is interpreted as a right-click.
Local actions When you attach a local action to a sprite, that action responds only to a trigger that is attached to that same sprite. The following table describes the available local actions. Name Effect Description Create Box Primitive Adds a box to the 3D world each time the trigger action occurs. The author can set the dimensions and texture. Create Particle System Primitive Creates a particle system whenever the trigger is activated.
Name Effect Description Pan Camera Horizontal Camera Pans along the horizontal axis by a specified number of degrees each time the trigger action occurs. Panning left and panning right require separate triggers. Pan Camera Vertical Camera Pans along the vertical axis (up and down) by a specified number of degrees each time the trigger action occurs. Panning up and panning down require separate triggers.
Applying 3D behaviors You apply 3D behaviors in the same way as standard behaviors in Director. You can attach as many behaviors to a sprite as needed, but each behavior that requires a trigger must have a unique trigger to activate it. To apply a 3D behavior: 1 Open the Library palette. 2 Open the 3D library. 3 Attach an action behavior to the sprite either on the Stage or in the Score. The Parameters dialog box appears. You can use this dialog box to control the behavior.
6 For local behaviors, attach a trigger behavior to the same sprite. For public behaviors, attach a trigger behavior to a specific sprite. The Parameters dialog box appears. You can use this dialog box to control when the trigger should work; what modifier keys, if any, are associated with the trigger; and to which sprite group the trigger is assigned. For more information about groups, see “About behavior groups” on page 333. 7 Specify options in the Parameters dialog box. 8 Click OK.
Chapter 15: The 3D Cast Member, 3D Text, and 3D Behaviors
CHAPTER 16 Working with Models and Model Resources This chapter covers the Lingo or JavaScript syntax methods and properties used to work with models and model resources, as well as lights and cameras to enhance Macromedia Director MX 2004 three-dimensional (3D) movies. For more information about the methods and properties listed here, see the Scripting Reference topics in the Director Help Panel, where you can find syntax, definitions, and examples.
Model resources Model resources are 3D geometries defined in 3D modeling software or created in Director MX 2004 by scripting in Lingo or JavaScript syntax. A model is an object that makes use of a model resource’s geometry and occupies a particular position and orientation within the 3D world. Model resources are viewable only when in use by a model. Several models may use the same model resource.
Primitives Each type of primitive has its own set of methods and properties used to define its appearance. Use the newModelResource() method to create the various primitives at runtime. Exceptions include mesh model resources, which require you to use the newMesh() method, and extruder resources, which require you to use the extrude3D() method of a text cast member. Sphere properties Spheres created at runtime aren’t saved with the cast member’s media when the Director movie is saved. Their type is #sphere.
Property Access Description Value Range resolution Get and set Number of polygonal segments around the circumference of the circle. Controls the smoothness of the cylinder’s appearance. An integer value greater than 1. height Get and set Height of the cylinder along the z-axis. Positive floating-point value. The default is 50.0. topCap Get and set Value indicating whether the top of the cylinder is closed or open. TRUE = closed. TRUE or FALSE. The default is TRUE.
Property Access Description Value Range lengthVertices Get and set Number of vertices along the length of the 2 or more. The default box. Increasing the number of vertices is 4. improves lighting effects. width Vertices Get and set Number of vertices along the width of the 2 or more. The default box. Increasing the number of vertices is 4. improves lighting effects. height Vertices Get and set Number of vertices along the height of the 2 or more. The default box.
Use these properties to work with mesh primitives: Property Access Description vertexList Get and set Vector values for each vertex in the mesh. Set the value to the Several faces may share a single vertex. number of vectors specified in your newMesh call. normalList Get and set Vector values for each normal in the mesh. Several faces may share a single normal. A normalized vector is one in which all components are of unit length.
Property Access Description Value Range face[index]. normals Get and set List indicating which normals to use for faces at designated index points. Set the value to a list of three integers specifying the indexes of the normals in the normalList that each point of the triangle should use. Don’t set a value if you aren’t defining your own normals. List indicating which texture coordinates to use for faces at designated index points.
Mesh generator methods Use these methods to work with mesh primitives: Method Description Returns build() Nothing Builds the mesh according to the current property values. (The mesh construction properties specified in the previous table have no effect until build() is called.) Generates a script error if any properties specify an invalid list. generateNormals (style) Nothing Generates a new normal for every vertex in every triangle.
Property Access Description Value Range sizeRange. end Get and set Size of a particle at the end of its life. The Positive integer. The default is 1. size is linearly interpolated between startSize and endSize. blendRange. start Get and set Opacity of a particle at the start of its life. blendRange. end Get and set Opacity of a particle at the end of its life. Any value between 0.0 and 100.0. texture Get and set Texture to use when drawing each particle. The default is void. Texture object.
Property Access Description Value Range emitter. path Get and set Vector positions that define the path the particles follow. Vector list. emitter. path Strength Get and set Degree to which particles remain on a path. emitter.min Speed Get and set Minimum emission speed. (Particles are emitted at random speeds between a minimum and a maximum.) Settable value. The default is 1.0. emitter.max Speed Get and set Maximum emission speed.
Cast member methods If the models and model resources you need aren’t contained in a particular cast member, the following methods let you create models and model resources using other 3D cast members at runtime. Method Description Returns loadFile (fileName, Overwrite, GenerateUnique Names) This method loads a W3D format file from fileName, adds all models as children of the world, and updates all palettes.
Method Description Returns newModel Resource(name, type) Creates a new model resource and adds it to the model resource palette. The type can be #plane, #box, #sphere, #cylinder, or #particle. The type cannot be #mesh. To create a new mesh model resource, use the newMesh method detailed below. New model resource object newMesh(name, numFaces, numVertices, numNormals numColors, numTexture Coordinates) New mesh model Creates a new mesh model resource.
Node types A model is one of four types of objects that share the same transform, parent, and child properties. The others are cameras, lights, and groups. Models, cameras, lights, and groups are generically referred to as node types or nodes. Nodes can be each other’s parents or children, so long as any one node has exactly one parent. A node can have any number of children. A model, for example, can be the child of a light and the parent of a group.
Property Access Description Value bounding Sphere Get A list containing a vector and a floating-point [vector (0,0,0), 0.0] value. The vector represents the world position and the value represents the radius of a bounding sphere surrounding the model and all its children. world Position Get and set Position of the model in world coordinates. Shortcut for the method Vector object. node.getWorldTransform ().position.
Model methods Use these methods to work with models: Method Description Returns addChild(aNode, preserveWorld) Nothing Adds aNode to this model’s list of children. An equivalent operation is to set aNode.parent to equal this model. The preserveWorld argument is optional. It can have two values: #preserveWorld or #preserveParent. If the value is #preserveWorld, the default, the world transform of the child being added remains intact.
Method Description isInWorld() Returns a Boolean value indicating if the model is TRUE (1) or currently in the world (TRUE) or not (FALSE). This FALSE (0) is useful for detecting if a given node's parentheirarchy tree terminates with the world group object or not. registerScript (eventName, handlerName, scriptInstance) Nothing Registers a handler named handlerName that is called in the scriptInstance when the member method sendEvent() is called with eventName as an argument.
Method Description Returns rotate (position, axis, angle, relativeTo) Nothing Rotates the model around the axis vector in the specified position the specified number of degrees. The relativeTo argument is optional and defaults to #self. scale(uniform Scale) Scales the model the same amount in all directions. Nothing scale(x, y, z) Scales the model by a factor of x in the x dimension, y in the y dimension, and z in the z dimension. Scaling is applied in object-relative space.
or car.child[1].rotate(0,10,0, #self) • • • where the fourth parameter of the rotate method is the object the rotation should be relative to. Parent-relative: A model’s transform property expresses its position and rotation relative to the model’s parent. If you want the wheels of the car to move outward regardless of how the wheels are turned, use car.child[1].translate(10,0,0,#parent) or car.child[1].transform.translate(10,0,0).
Property Name Access Description Default shininess Get and set An integer between 0 and 100 indicating 30.0 how shiny a surface is. emissive Get and set A color object describing the color of light this object seems to give off. This does not turn the surface using this shader into a light source; it just gives it the appearance of being one. blend Get and set An integer between 0 and 100 indicating 100 how transparent (0) or opaque (100) this surfaces is.
Property Name Access Description Default textureList [index] Get and set A shader can use up to eight layers of textures. This property gives access to the texture at the indicated index position. void texture Get and set This property allows access to the texture for the first layer. It is equivalent to textureList[1]. void An argument of void can be used to disable texturing for the first layer. reflectionMap Get and set Get: Returns the texture associated with void the third layer.
Property Name Access Description Default textureMode List[index] Get and set #none This property allows access to the texture coordinate generation method used for a texture at the texture level and then to allows you to change how textures are applied to a model’s surface.
Property Name Access Description Default wrapTransform List Get and set Controls the orientation of UV generation in model space. Get: Returns a list of texture coordinate generation transforms, one per layer. Set: Specifies a texture coordinate generation transform to be applied to all layers. transform(50.0 000,0.0000,0.0 000,0.0000, 0.0000,50.0000 ,0.0000,0.0000 , 0.0000,0.0000, 50.0000,0.0000 , 0.0000,0.0000, 0.0000,1.
Property Name Access Description Default blendFunction List[index] Get and set #multiply Access to the blending method associated with a texture layer at the position indicated by index, which must be a positive integer smaller than or equal to 8. Possible values are as follows: #replace #multiply #add #blend #alpha #constant For detailed information about all of these options, see the Scripting Reference topics in the Director Help Panel.
Property Name Access Description Default blendConstant List[index] Get and set The blending ratio used for a specific layer when the blend method is set to #blend and blendSourceList[index] is set to #constant. Returns a floatingpoint value from 0.0 to 100.0. 50.0 blendConstant List Get and set 50.0 The blending ratio used for any layer when the blend method is set to #blend and blendSourceList[index] is set to #constant. Returns a floating-point value from 0.0 to 100.0.
Properties of the painter shader The #painter shader gives the model a painted effect.
Properties of the engraver shader The #engraver shader gives the effect of an engraved metal surface. You can control the size and number of etched lines by adjusting the brightness and density properties, respectively. Use these properties to work with the engraver shader: Property Access Description Default name Get and set Name of shader None brightness Get and set Value controlling amount of white in shader 0.
Property Access Description Default width Get Width, in pixels. None height Get Height, in pixels. None quality Get and set #medium Property with the following possible values: #low: texture is not mipmapped #medium: mipmapping is at a low bilinear setting (default) #high: the mipmapping is at a high trilinear setting For more information, see the Scripting Reference topics in the Director Help Panel.
Property Access compressed Get and set Description Default The property can be TRUE (1) or FALSE TRUE (1) (0): TRUE (1): the texture is compressed FALSE (0): the texture is not compressed The value changes automatically from TRUE (1) to FALSE (0) when the texture is to be rendered. The value can be set to FALSE (0) to decompress or to TRUE (1) to remove the decompressed representation from memory.
Groups Groups have many of the same properties and methods as models, except that you need to substitute the word group for the word model when writing scripts. A group is a node that can have a parent and/or children. These can be models, lights, cameras, or other groups. Group properties The properties of the group determine its particular appearance and relationship to the rest of the 3D world. Use these properties to work with groups: Property Access Description Value name Get Unique string name.
Group methods Use these methods to work with groups: 364 Method Description addChild(aNode, preserveWorld) Nothing Adds aNode to this group’s list of children. An equivalent operation is to set aNode.parent to equal this group. The preserveWorld argument is optional. It can have two values: #preserveWorld or #preserveParent. If the value is #preserveWorld, the world transform of the child being added remains intact.
Method Description Returns registerScript (eventName, handlerName, scriptInstance) Registers a handler named handlerName that is called Nothing in the scriptInstance when the member method sendEvent() is called with eventName as an argument. If scriptInstance is 0, a movie script handler is called. The user defines what eventName is. The eventName specified can be one of a default set of events or a user defined custom event.
Method Description Returns pointAt(world Rotates the model until it points at the world-relative Nothing Position, worldUp) position worldPosition. The optional worldUp argument gives the general position of the model’s Up axis. The exact position can’t be determined using this method. Both the object-relative axes are defined by the pointAtOrientation property. Default values are an object-relative forward direction of vector (0, 0, -1) and an object-relative up direction of vector (0, 1, 0).
Use these properties to work with the level of detail modifier: Property Access Description Default whichModel.lod.auto Get and set TRUE (1) means that polygons are TRUE (1). automatically reduced based on the distance from the camera. The fewer polygons that are drawn, the faster performance will be. The lod.bias property controls how aggressively this takes place.
Toon modifier properties The toon modifier changes a model’s rendering to imitate a cartoon drawing style. Only a few colors are used, and the model’s shader, texture, and related properties are ignored. Use these properties to work with the toon modifier: Property Access Description Default whichModel.toon.
Use these properties to work with the inker modifier: Property Access Description Default whichModel. inker.lineColor Get and set Color object describing line color Black whichModel. inker. silhouettes Get and set whichModel. inker.creases Get and set model.inker. creaseAngle Get and set A floating-point value controlling crease 0.01 angle detection whichModel. inker.
Property Access whichModel.sds.tension Get and set whichModel.sds.error Get and set Description Default Percentage of matching between modified and original surfaces. 65 Percentage of error tolerance. This property applies only if sds.subdivision equals #adaptive. 0.0 Collision modifier properties The collision modifier allows a model to be notified of and respond to collisions. You can access a model’s collision modifier properties using syntax such as model.collision.whichProperty.
Property Access Description Default whichModel.collision.i Get and set mmovable TRUE (1) or FALSE (0) value indicating FALSE (0) whichModel.collision. Get and set Indicates the geometry to be used in the collision detection algorithm. Using simpler geometry such as the bounding sphere leads to better performance. The possible values for this property are: #mesh: uses the actual mesh geometry of the model's resource. This gives onetriangle precision and is usually slower than #box or #sphere.
Collision modifier events These events are generated when collisions occur: Event Name Description #collideAny The first event called when any collision occurs. #collideWith The event called whenever a collision with a specified model occurs. It is implicitly registered for when setCollisionCallback() is called. Animation modifiers Once you’ve created animations in your modeling software, you apply animation modifiers to models to play them back in Director.
You can add the Keyframe player modifier at runtime to a model created in Director, but you cannot add the Bones player modifier at runtime. The Bones player modifier is automatically attached to models with bones animation exported from a 3D modeling application. Since the required bones information can’t be assigned in Director, it has to exist before the model is imported into Director. Bones player methods Use these methods to work with bones animations: Method Description whichModel.bonesPlayer.
Bones player properties Use these properties to work with bones animations: Property Access Description Default whichModel.bonesPlay er.playing Get TRUE (1)= playing; FALSE (0)= paused. TRUE (1) whichModel. bonesPlayer. playList Get A linear list of property lists, where each Empty list [] property list yields the parameters for the currently playing and queued animations. For example, [[#name: "Walk_rt_turn", #loop: 0, #startTime: 0, #endTime: 4000, #scale: 1.
Property Access Description Default whichModel. bonesPlayer. autoBlend Get and set If TRUE, automatic linear blending (from 0.0 to 100.0) is applied over the blend time. Otherwise, blendTime is ignored, and the amount of blending is userdetermined by the blendFactor property. TRUE (1) whichModel. bonesPlayer. blendFactor Get and set 0 The degree of blending between motions, expressed as a floating-point value between 0.0 and 100.0. A value of 0.0 uses all the previous motion. A value of 100.
Property Access Description Default whichModel. bonesPlayer. rotationReset Get and set #all Normally a model snaps back to its original rotation after a motion finishes playing. This property maintains any or all of the rotational changes after playing is complete. The values are as follows: #none #x #y #z #xy #xz #all whichModel. bonesPlayer. lockTranslation Get and set Defines the axis of translation to ignore when playing back a motion.
Keyframe player methods Use these methods to work with keyframe animations: Method Description Returns whichModel.keyframePlayer.play ("name", looped, startTime, endTime, playRate, timeOffset) Plays the motion named name starting at Nothing the time startTime, with the currently playing motion being pushed down the play list. If looped is FALSE (0), the preceding motion begins again when this motion completes.
Keyframe player properties Use these properties to work with keyframe animations: Property Access Description Returns whichModel. keyframePlayer. playing Get TRUE (1)= playing; FALSE (0)= paused. TRUE (1) whichModel. keyframePlayer. playList Get A linear list of property lists, where each Empty list [] property list yields the parameters for the currently playing and queued animations. For example, [[#name: "Walk_rt_turn", #loop: 0, #startTime: 0, #endTime: 4000, #scale: 1.
Property Access Description Returns whichModel. keyframePlayer. blendFactor Get and set 0 The degree of blending between motions, expressed as a floating-point value between 0.0 and 100.0. A value of 0.0 uses all the previous motion. A value of 100.0 uses all of the next motion. The blendFactor can be changed frame by frame to create custom blending effects. whichModel. keyframePlayer.
Keyframe player events These events are generated by keyframe animations: Event name Description #animation Started This is a system-defined notification event triggered when a motion begins playing. If looping is on, this event is triggered only by the first playthrough. During a blend of two animations, this event will be triggered as the blend begins. #animationEnded This is a system-defined notification event triggered when a motion ends.
Property Access Description whichModel. meshDeform. mesh[index]. face[index] Get Returns a list of three indexes into the vertex, normal, texture coordinate, and color lists. These indexes correspond to the corners of the face for the specified mesh. whichModel. meshDeform. mesh[index]. face[index]. neighbor[index] Get Returns a list of lists describing the neighbors of a particular face of a mesh opposite the face corner specified by the neighbor index (1,2,3).
Motion methods Use this method to work with motions: Method Description map(motion, "bone name") Maps the given motion into the current motion beginning at the named bone. If no bone name is specified, the mapping begins at the root bone. The map() method will replace any motion tracks mapped previously to the specified bone and all of its children. Motion mapping has no effect on motions that are already on a play list. The map() method does not work with keyframe animations.
Light properties Use these properties to work with lights: Property Name Access Description Default name Get Unique name of this light. None If the light was exported from a 3D modeling package, the name is the name assigned there. parent Get and set The model, light, camera, or group that is Group ("World") this light’s parent. If the light has no parent, it cannot contribute light. child.count Get Number of immediate children (no grandchildren) that the light has.
Property Name Access Description Default spotAngle Get and set Angle of the light’s projection cone. If type equals #spot, setting a value less than the umbra causes a “property not found” error. 90.0 attenuation Get and set A three-value vector controlling the constant, linear, and quadratic attenuation factors for spotlights. vector (1.0,0.0,0.0) specular Get and set TRUE (1)/FALSE (0) value that controls whether or not the light produces specular effects on surfaces.
Method Description Returns clone(name) Light object Clones a light named name, adds it to light’s parent’s child list, and adds it to the world. All children of the light are automatically cloned.This can be avoided by removing the children, performing the cloning operation, and then adding the children back. If the name is omitted or is "", the clone isn’t added to the light palette, has no parent, and has no children. This option lets you quickly create temporary light instances.
Method Description Returns translate(x,y,z, relativeTo) Moves the light distance x along the x-axis, distance y along Nothing the y-axis, and distance z along the z-axis. The relativeTo argument is optional and defaults to #self. This method can also be written as translate (vector(x,y,z) relativeTo) rotate(x,y,z, relativeTo) Rotates the light by x degrees around the x-axis, y degrees Nothing around the y-axis, and z degrees around the z-axis. The relativeTo argument is optional and defaults to #self.
Camera properties Use these properties to work with cameras: Property Name Access Description Default name Get and set None Unique name of this camera. If the camera was exported from a 3D modeling program, the name is the name assigned there. parent Get and set group The model, light, camera, or group ("world") that is this light’s parent. If the camera has no parent, it cannot contribute light. child.count Get Number of immediate children (no grandchildren) the camera has.
Property Name Access Description Default colorBuffer. clearAtRender Get and set TRUE (1) or FALSE (0) TRUE (1) colorBuffer. clearValue Get and set Color object defining color used to clear out buffer if colorBuffer.clearAtRender is TRUE (1). color(0,0,0) fog.enabled Get and set TRUE (1) or FALSE (0) value FALSE (0) value indicating whether color buffer is or isn’t cleared out after each frame.
Property Name Access Description Default overlay[index]. loc Get and set Location, in pixels, of the overlay, as measured from the upper left corner of the sprite’s rect to the overlay[index].source’s regPoint. point(0,0) overlay[index]. source Get and set Texture object used as the source for None this overlay. overlay[index]. scale Get and set Scale value used by a specific overlay 1.0 in the camera’s list of overlays. overlay[index].
Property Name Access Description Default boundingSphere Get [vector (0,0,0), A list containing a vector and a 0.0] floating-point value, with the vector representing the position and the value the radius of a bounding sphere surrounding the camera and all its children. worldPosition Get and set Vector object Position of the camera in world coordinates. Shortcut for the method node.getWorldTransform ().position.
Method Description Returns isInWorld() Returns a Boolean value indicating if the camera is currently in the world (TRUE) or not (FALSE). This is useful for detecting if a given node's parent-heirarchy tree terminates with the world group object or not. TRUE (1) or FALSE (0) registerScript (eventName, handlerName, scriptInstance) Registers a handler named handlerName that is called in Nothing the scriptInstance when the member method sendEvent() is called with eventName as an argument.
Chapter 16: Working with Models and Model Resources
CHAPTER 17 Controlling the 3D World Macromedia Director MX 2004 provides powerful methods for overall control of the three-dimensional (3D) world, including Lingo and JavaScript syntax for handling new 3Dgenerated events, selecting models (picking), vector math operations, and transforms. In addition, the properties and methods of the Director global renderer services object supply common rendering properties for all 3D sprites and cast members.
Use these methods to set up event handling: Method Description Returns registerForEvent (eventName, handlerName, scriptInstance, model) The event eventName is one of the following: #collideAny: Called when any collision occurs. #collideWith: Called when a collision with a specific model occurs and implicitly registered when setCollisionCallback(...) is called. Equivalent to calling TRUE (1) if the operation succeeds. FALSE (0) if the operation fails. model.collision.setCollision Callback.
These properties are included in the collisionData object passed to the handler: Property Access Description modelA Get One model in the collision. If the script includes registration for collision with a particular model, modelA is that model. modelB Get The second model in the collision. pointOf Contact Get Vector describing world-space location of collision. Available only if the collision has been resolved.
Camera methods These camera methods let you determine which models have been clicked when a user clicks the mouse within a 3D sprite. You can also translate coordinates in 3D space to coordinates in 2D sprite space and vice versa. Method Description Returns worldSpaceTo SpriteSpace (vector) Returns the 2D sprite-space coordinates of a point from A point. a 3D world vector. spriteSpaceTo WorldSpace (point) A vector.
Vector math A 3D vector describes both direction and location in 3D space. Vector objects include floatingpoint values for position along each of the x-, y-, and z-axes. Vectors can be node-relative or world-relative. If they are node-relative, their x, y, and z values are relative to the position of the node. If they are world-relative, their x, y, and z directions are relative to the world. Vector math operations perform calculations using each of the x, y, and z values.
Vector methods Use these methods to work with vectors: Method Description normalize() Normalizes the vector by modifying it into a unit vector of Nothing. Vector is length 1. This is done by dividing each component of the modified. vector by the vector’s original length. That original length is the square root of the sum of the squares of each component. get Normalized() Returns a normalized version of the vector.
Operator Description Returns vector2/scalar Returns a new vector equaling vector2/scalar. A new vector object transform* vector Returns a new vector resulting from applying the positional and transformation changes defined by transform to vector. Note that vector*transform is an invalid operation. A new vector object scalar-vector1 Returns a new vector equaling scalar-vector1. A new vector object vector1-scalar Returns a new vector equaling vector1-scalar.
Property Access Description Default rotation Get and set vector Script vector object describing the (0,0,0) xRotation, yRotation, and zRotation components of the transform with the value vector(xRotation, yRotation, zRotation), with the rotation values defined in degrees. This value can vary because of the permissible types of transform operation.
Transform methods Use these methods to work with transforms: Method Description Returns rotate (xAngle, yAngle, zAngle) Applies a rotation transformation after the current transformation: Nothing model.transform.identity() model.transform.translate(100,0,0) model.transform.rotate(0,0,90) After this series of transformations, performed in this order, the model’s local origin will be at (0,100,0), assuming the model’s parent is the world.
Method Description Returns preTranslate (xIncrement, yIncrement, zIncrement) Translates the position of the transform before the current transformation: Nothing model.transform.identity() model.transform.rotate(0,90,0) model.transform.translate(100,0,0) After this series of transformations, performed in this order, the model’s local origin will be at (0,0,100), assuming the model’s parent is the world.
Transform operator Use the asterisk (*) to multiply two transforms: Operator Description Returns transform1 * transform2 Returns a new transform that is the product of the two original A new transform object transforms. Useful for combining the effects of two transforms. Rendering functionality The Director global rendererServices object encapsulates information about the functionality common to all 3D cast members and sprites in a movie.
Property Access Description Default modifiers Get A list of modifiers available for 3D cast members. Possible values are as follows: None #lod #toon #sds #bonesPlayer #keyframePlayer #inker #collision #meshDeform primitives Get A list of basic 3D shapes available for all None 3D cast members.
Property Access Description Default colorBuffer Depth Get Either 16 or 32, depending on the hardware card. Controls the precision of the hardware output buffer.
Cast member properties You can control most cast member properties using the Property inspector. For more information, see “Using the Property inspector for 3D” on page 308. Use the following properties to work with 3D cast members in script: Property Access Description Default preload Get and set TRUE (1) or FALSE (0) specification of None whether the member is preloaded before display and playback or streamed in during playback. This property is only available for linked cast members.
Property Access Description Default diffuseColor Get and set Diffuse color of first shader: the shader’s overall color. rgb(255, 255,255) textureType Get and set Default texture type for world. Values are as follows: #none: no texture #default: use original texture from Shader #member: use image from specified cast member #default texture Member Get and set Name of cast member to use as the source for the default texture when textureType is set to #member.
Sprite properties You can control the directToStage and bgColor properties using the Property inspector. For more information, see “Using the Property inspector for 3D” on page 308. Use the following properties to work with 3D sprites in scripts.: Property Access Description Default directTo Stage Get and set TRUE (1) or FALSE (0) specification of TRUE (1): whether rendering occurs directly to the rendering Stage or to the Director offscreen buffer.
CHAPTER 18 Movies in a Window Macromedia Director MX 2004 can play several movies simultaneously by creating windows in which additional movies can play. A movie in a window (MIAW) is a distinct Director movie that retains all its interactivity. You can use a MIAW to play another movie in a separate window while the main movie plays on the Stage. In addition, movies in windows and the main movie can communicate and interact with each other.
About MIAWs A MIAW is the combination of a window object and a movie object. In fact, there is no such thing as a MIAW object, but it is the name used to describe the concept of this unique combination of window and movie objects. Most of the properties described in this section are really window properties, but apply to a MIAW. MIAWs and windows are not identical, and it is important to keep that in mind.
To open a MIAW: • Use the following script: -- Lingo window().new("movieName") window("movieName").open() -orwindow().new("movieName").open() // JavaScript syntax new window("movieName"); window("movieName").open(); -ornew window("movieName").open(); Unless you explicitly preload the movie through scripting, Director doesn’t load the movie into memory until the window is opened, which can cause a noticeable pause. To load the first frame of the movie, use the preLoadMovie method.
Setting the window size and location for a MIAW Setting the screen coordinates for a MIAW lets you control the size of the window and where it appears. Setting the coordinates before the movie appears controls the initial position of the window; setting them after the window appears moves the window. About rect, drawRect, and stageRect There are three rect values of concern: rect, drawRect and sourceRect. All three properties are available off of the stage or the window: _movie.stage.rect _movie.stage.
Controlling the appearance of a MIAW You can control the appearance of a MIAW by setting different appearance properties. You can do this by using Lingo or JavaScript syntax. Some default appearance properties can also be set by using the Display Template tab found in the Property inspector. You can set the type of window you want—for example, a tool window—and how it will behave and act. For example, a document window can have a titlebar, be resizable, and have a minimize and maximize box.
Minimize Box determines if a minimize box appears in the title bar. For example: window("window_name").titlebarOptions.maximizebox = true Visible determines whether the title bar of a window is visible. When you set this property to false, the other options (Maximize Box, Close Box, and so forth) remain untouched. The next time the window’s title bar is visible, all other title bar properties are maintained. In other words, it lets you override or keep changes made to these properties.
Window appearance methods There are several new window appearance methods in Director MX 2004 that apply to MIAWs. For more information about these methods, see the Scripting Reference topics in the Director Help Panel. The following are three of these methods: • lets you minimize your windows. You can call this function when they make custom title bars. Here is an example: minimize() window ("miaw").minimize() • lets you maximize windows. You can call this function when you make custom title bars.
Controlling MIAW layering To control whether a movie appears in front of or behind other windows: • Use the moveToFront() and moveToBack() methods. For more information about these methods, see the Scripting Reference topics in the Director Help Panel. This code moves a MIAW to the front: window("miaw").moveToFront() This code moves a MIAW to the back: window("miaw").
For more information, see the Scripting Reference topics in the Director Help Panel. Listing the current MIAWs The windowList property displays a list of all known MIAWs in the main movie. For example, the following statement displays a list of current MIAW names in the Message window: put_player.windowList For more information about this property, see the Scripting Reference topics in the Director Help Panel.
Chapter 18: Movies in a Window
CHAPTER 19 Using the XML Parser Xtra The XML Parser Xtra lets Macromedia Director MX 2004 movies read, parse, and use the contents of Extensible Markup Language (XML) documents. Using the XML Parser Xtra requires that you understand the structure and content of the documents you are parsing. You can then access the XML document’s contents through Lingo or JavaScript syntax or convert the contents to a script list that is meaningful to you and your movie.
There are many sources of information for understanding, creating, and editing XML on the Internet. The following websites offer useful information about XML: • • • • www.xml.com www.ucc.ie/xml/ www.w3.org/TR/REC-xml www.w3.org/DOM/ Using XML parser objects The XML Parser Xtra lets Director developers access the nodes of an XML document.
The following example shows a short XML document: element 2element 3 The following example is the same XML with its tree structure shown more clearly: element 2 element 3 There are two ways to access a parsed XML document.
errCode = gParserObject.parseString(member("XMLtext").text) theList = gParserObject.makeList() After this code has been executed, the variable gParserObject contains the parsed node structure of the XML document, and the variable theList is a property list that contains all the information in the document broken into property name and value pairs. All the regular script methods for sorting and accessing lists can work normally with theList.
Using this XML document as a starting point, the following examples demonstrate how to use these script terms to access the data within various node levels of the XML structure. The XML looks like the following example: element 2 element 3 Here is some text The following script returns the name of the first XML tag: put gParserObject.child[1].name -- "e1" The gParserObject variable contains the parsed XML.
This script returns the text of the fourth child of the e1 tag, as shown in the following example: put gParserObject.child[1].child[4].text -- " here is some text " The text element includes the white space for Return, Space, and Tab characters as well as the string "here is some text". You can use the script count method to determine the number of children that exist at a particular level of the XML structure.
The following script returns the root node’s type, name, and number of children: put gParser.type, gParser.name, gParser.count(#child) -- #element "ROOT OF XML DOCUMENT" 1 The main difference between the root node and its child nodes is that there are several script methods that apply to the entire XML document and operate on the root node only. These methods include doneParsing(), getError(), ignoreWhiteSpace(), makeList(), parseString(), and parseURL().
This requirement applies to documents parsed by parseString() as well as files that are parsed by parseURL(). The XML Parser Xtra supports the following character sets: • • • • • • ISO-8859-1 Also called Latin 1. This is the most common Western encoding used on the web. It matches the default character set used on Windows in most Western countries.
CHAPTER 20 Making Director Movies Accessible As a Macromedia Director MX 2004 author, you might want to provide ways for computer users with disabilities to experience the movies that you create. Director includes accessibility features that let you do this. By using these features, you can make existing and new movies accessible to users who have hearing, visual, or mobility impairment. With scripts and behaviors, you can add text-to-speech capability to your movies.
Using the Speech Xtra The Speech Xtra adds special methods to scripting that enable the Director text-to-speech capability. The text-to-speech behaviors require this Xtra extension because they use these script methods. If you write custom text-to-speech scripts, you must include the Speech Xtra in your movie’s Xtra extensions list. Keyboard navigation does not require the Speech Xtra. The Speech Xtra supports Microsoft SAPI 4 and 5 on Windows.
Enabling keyboard navigation With the Accessibility Behavior library, you can easily make sprites on the Stage navigable with the keyboard. This lets mobility-impaired users select sprites and simulate mouse clicks without using a mouse. For example, if you have four button sprites on the Stage, you can apply accessibility behaviors that let them be selected by using the Tab key. As each sprite is selected, it is highlighted with a colored rectangle, called a focus ring, around its bounding rectangle.
6 In the dialog box that appears, enter a name for the behavior group. Because the accessibility behaviors work together and are dependent on one another, a group name associates all the accessibility behaviors used in a given scene of your movie with one another. When you apply behaviors to a different scene of your movie, you might want to use a different group name. For example, you might use Accessibility_Scene_1.
5 Repeat this process for each sprite in the scene that you want to be navigable. Note: The Accessibility Item and Accessibility Text Edit Item behaviors cannot be applied to sprites that have the Accessibility Target or Accessibility Keyboard Controller behaviors attached. If you are testing your movie while applying Accessibility Item or Accessibility Text Edit Item behaviors, you might need to rewind your movie to restore the shape sprite with the Accessibility Target behavior to its original location.
To apply the Accessibility Speak behavior: 1 Begin by applying the keyboard navigation behaviors to sprites in your scene. For more information, see “Enabling keyboard navigation” on page 429. 2 Drag the Accessibility Speak behavior from the Library palette to the sprite you want to trigger the spoken text when the user navigates to it with the Tab key. This sprite must already be attached to an Accessibility Item or Accessibility Text Edit Item and an Accessibility Group Order behavior.
Using captioning For users who are hearing impaired, you can add text captioning to your movies. Captioning is the practice of displaying text that corresponds to spoken narration or other sounds being played. Using the captioning behaviors in addition to the text-to-speech behaviors lets you make your movies accessible to users with all types of disabilities. There are two captioning behaviors that are designed to be used together.
8 In the Display How Many of the Words That Follow text box, enter the number of words to display after the word number you selected in the previous step. For example if you want to display 22 words of text after word 16, enter 22 in this text box. 9 In the remaining text boxes, enter the numbers of the first word of each section of text followed by the number of words in each section. To use more than five sections, drop this behavior on the sprite again.
To resume the speech: • Use the voiceResume() method. To stop speech synthesis: • Use the voiceStop() method. To check whether the speech is currently speaking, paused, or stopped: • Use the voiceState() method. To set the volume of the voice: • Use the voiceSetVolume() method. To set the pitch of the voice: • Use the voiceSetPitch() method. To determine the chronological number of the current word within the string being spoken: • Use the voiceWordPos() method.
To add the Speech Xtra to the movie’s Xtra extensions list: 1 Open the movie. 2 Select Modify > Movie > Xtras. 3 In the dialog box that appears, click Add. A second dialog box appears. 4 In the alphabetical list of Xtra extensions, scroll to Speech, and select the Speech Xtra. (In Windows, the file name is Speech.x32.) 5 Click OK. The Add Xtras dialog box closes. 6 Click OK again. The Movie Xtras dialog box closes. 7 Save your movie.
CHAPTER 21 Managing Memory Macromedia Director MX 2004 has effective built-in memory management that is sufficient for most projects. To make memory available for new sprites, Director simply unloads the cast members used for sprites that are no longer on the Stage. However, sometimes large cast members, such as high resolution images, large sounds, or digital video, can take longer to load or unload than typical, smaller cast members.
Monitoring memory use The Memory inspector displays information about how much memory is available to Director for your movie and indicates how much memory different parts of the current movie use and the total disk space the movie occupies. It also can purge all removable items from RAM if you are about to perform a memory-intensive operation. Note: The Memory inspector is not available on Macintosh. To use the Memory inspector: 1 Select Window > Memory Inspector.
Using script to change a cast member’s purgePriority property is a good technique for controlling memory management. However, changes to the purgePriority property do not take effect until the next time a cast member is used. For example, if you change the property in an exitFrame or enterFrame script in the same frame as a cast member is used, the cast member is treated as if it had its old priority because all drawing on the screen is done before any enterFrame or exitFrame scripts are performed.
5 In the frame where you want the video to appear, use script to set the sprite’s loc property to place the sprite on the Stage in the location you select. 6 Set the movieRate property to 1 to start playing the video. This way, the video loads its initial segment into memory and is ready to play immediately when your movie reaches the frame where you want it to appear.
CHAPTER 22 Managing and Testing Director Projects As you work with Macromedia Director MX 2004 and develop projects with it, you might encounter some situations where a seemingly small change in the design of a project has a significant effect on the organization of the Director files and media files associated with it. A little bit of planning before you start a Director project can help avoid difficult changes during the course of development.
• Organize the cast members in your cast in a logical way. You might choose to group all the cast • members of a particular type together, or you might choose to group the cast members from each scene together. Choose a system that works for you and that will make it easy to find cast members when your cast becomes large. You can also choose to keep groups of cast members in separate casts.
About testing movies to avoid problems While you develop movies, you might encounter some difficulties because creating interesting movies and trying out new ideas always involves some experimentation. By testing your movies according to the simple guidelines described in this section, you can prevent problems from becoming obstacles.
Testing strategies You can use the following strategies to test your movies effectively: • Testing in the Director authoring environment is different than testing in the Director • • • • • Projector and Macromedia Shockwave environments for online content. The Preview in Browser command demonstrates the true behavior of the movie in the Shockwave environment. If you encounter a problem, try to isolate the problem in a new Director file that incorporates only the problem feature or item.
3 To specify which frames of your movie are printed, select one of the following Frames options: Current Frame prints the frame that is currently on the Stage. prints the frames that are selected in the Score. All prints all of the frames in your movie. Range prints the range of frames specified in the Begin and End text boxes.
Chapter 22: Managing and Testing Director Projects
CHAPTER 23 Packaging Movies for Distribution When you finish authoring your Macromedia Director MX 2004 movie, you have a choice of several ways to prepare it for distribution. You can distribute a movie in the Macromedia Shockwave format that plays in a browser, or you can distribute it as a stand-alone projector. Stand-alone projectors can contain the software necessary to play the movie, or they can use an installed Macromedia Shockwave Player to play the movie independent of a browser.
For more information about how to distribute Xtra extensions with projectors, see TechNote 13965 in the Director Support Center at www.macromedia.com/go/director_support. Although the note might refer to Director 7, the information is the same for more recent versions of Director.
To preview a movie in a browser: • Select File > Preview in Browser or press F12. About Xtra extensions All Xtra extensions a movie requires must be installed on your user’s system when the movie runs. When you distribute a movie, you must either include these Xtra extensions or provide the user with the means to download them.
You can also exclude Xtra extensions in projectors. For more information, see “Excluding Xtra extensions from projectors” on page 462.
About distribution formats Before deciding how to distribute a movie, it helps to understand how Director plays movies. Director movies play either with the Shockwave Player or through a projector player. The Shockwave Player is a system component that plays movies in web browsers and also outside browsers as stand-alone applications. A projector player can only play movies independently of a web browser.
Distributing movies on a disk Whenever a movie plays from a disk, it accesses all external linked files the same way that it did in the authoring environment. All linked media—bitmaps, sounds, digital videos, and so on—must be in the same relative location as they were when you created the movie. To make sure you don’t forget any linked media when you distribute a movie on a disk, place linked files in the same folder as the projector or in a folder inside the Projector folder.
If your movie needs Xtra extensions that fall beyond the range of the default publish settings, (for example, Windows Media) you will be prompted to add them. In that case, you can set up your movie with the correct settings by changing them. Changing Publish Settings You can change Publish Settings by using the Publish Settings dialog box. Publish Settings lets you determine what type of Director movie you want to create, and what properties that movie shall have.
Selecting a publishing format Use the Formats tab to select the movie format you want and determine the types of files you wish to publish. It includes support for creating cross-platform projectors. To set options using the Formats tab: • To publish a Projector movie, click Projector. You can set more Projector options by using the • • • • • • • • Projector tab. For more information, see “Setting Projector options” on page 455.
Setting Projector options The Projector tab lets you set options that include how the projector movie appears on stage or in a browser, and what type of player it is shown on. To set options using the Projector tab: 1 Select File > Publish Settings and click the Projector tab. 2 Set the options you want and click OK to keep your settings and return to the movie or Publish to begin the projector publishing process. For more information about setting Projector options, see “Creating projectors” on page 460.
Setting Shockwave options The Shockwave tab lets you set options that determine the Shockwave Player version, how images are compressed, how users interact with the movie once it’s published, and more. To set options using the Shockwave tab: 1 Select File > Publish Settings and select the Shockwave tab. 2 Select the options you want to provide for your users, as described in the following list: Version: ■ Select Shockwave Player 10 or Shockwave Player 8.5.
3 If you use the default Match Movie setting in the Dimensions field, values in the OBJECT and tags in the HTML file are set to the exact dimension of your movie. To change the dimensions, select either Pixels or Percent of Browser Window, and type the new dimensions in the Width and Height fields. Your movie will resize to fit the new rectangle only if you have not selected No Stretching in the Stretch Style pop-up menu on the Shockwave tab.
To let users resize the Stage without resizing the sprites, select Expand Stage Size. The movie is aligned within the browser based on the align tags that you specify in step 4. 5 To specify align tags for your movie, use the Horizontal Align and Vertical Align pop-up menus. You can select left, center, or right horizontal alignment, and top, center, or bottom vertical alignment. Setting Image options You can specify the images that should appear if the user doesn’t have Shockwave or the ActiveX control.
Using dswmedia folders and the support folder to publish Shockwave content Use a dswmedia folder to obtain data from a local source while a movie is playing in safe player mode. Director treats folders named dswmedia as exceptions to the safe player mode feature that normally stops movies from reading data from any local source. Any linked media or cast files in a dswmedia folder, or a subfolder of any depth, may be read by a movie running in safe player mode.
To be included as a file in a Projector, a movie must be created with Director 8.5 or newer. However, using Lingo, movies created with earlier versions of Director can be played (e.g. go to movie, play movie) back to and including movies created with Director 5. When you open a Director 7 movie in Director MX or convert it to the new format with Update Movies, the following changes occur to the movie: • The data structure is changed to the latest file format.
4 Select from the following options: Animate in Background lets the movie continue playing if a user switches to another application. This is useful if you want the movie to continue running in the background when its window is not active. If this option is not selected, the movie pauses when the user switches to another application and resumes when the user switches back. Full screen sets the movie to fill the entire screen when playing.
To create a fast-start projector: 1 Create a new folder on your computer desktop. It does not matter what you name the folder. 2 In Director, select Modify > Movie > Xtras. The Movies Xtras dialog box appears. 3 Select the name of each Xtra and deselect Include in Projector for each, then click OK. 4 Select File > Save and Compact. If you are adding multiple movies to the package, repeat steps 2 through 4 for each of the movies. 5 Select File > Create Projector.
• Shockwave projectors can use the Xtra extensions that have been already installed with Shockwave instead of requiring their own copy. • Because of the way the Xtra extensions list for the movie is maintained, it is possible to get Xtra extensions included in a projector that you don't need. For example, let’s say that you can use an animated GIF member in a movie. In this case, the AnimGif Xtra is added to the Xtra list and marked for downloading. Later you delete the animated GIF member.
Processing movies with Update Movies You can use the Update Movies command on the Xtras menu to do the following: • Update movies and casts from older version of Director to the latest file format. • Compress movies for faster downloading from the Internet. • Remove redundant and fragmented data in movie and cast files. The Save and Compact and Save As commands do this as well. • Prevent users from opening movie and cast files. • Batch-process movie and cast files in large projects.
6 Click Update. Director saves new versions of the selected movies with the same names and locations as the original movies. This ensures that all links and references to other files continue to work properly. Director copies the original movies to the folder you specified, re-creating their original folder structure. If you didn’t specify a folder for the original movies, Director prompts you to select one.
4 From the Format pop-up menu at the bottom of the dialog box, select a format. Windows: Video for Windows (.AVI), DIB File Sequence (.BMP), or QuickTime Movie (.MOV) ■ Macintosh: PICT or QuickTime Movie BMP is the standard format for a Windows bitmap series. PICT is the standard format for a Macintosh bitmap file format. If you are exporting video, click the Options button. The Video for Windows or QuickTime Options dialog box appears. Select the options you want to use and then click OK.
5 6 7 8 9 A movie that would work well with Tempo Settings as the Frame Rate option is one in which the tempos have been carefully timed. For instance, some frames could be set to a tempo of 10 frames per second, and their QuickTime frame durations would be exactly one-tenth of a second. Other frames later in the movie could be set to a tempo of 1 frame per second; when the movie is exported, these slower frames would each last precisely 1 second in the QuickTime movie.
Looped sounds don’t loop in a movie that you have exported as a digital video. To loop a sound in a movie that you plan to export as a digital video, you must trigger the sound by alternating it between the two sound channels. About organizing movie files In most cases, you should divide a large production into a series of smaller movies. You can combine as many movies as you want in a projector, but larger files take longer to save and are cumbersome to work with.
CHAPTER 24 Using Shockwave Player Macromedia Director MX 2004 movies can use the Internet in various ways: hosting multiuser sessions such as chats and games, streaming movies and sounds, retrieving data from the network, and interacting with a browser. Whether it is distributed on disk or downloaded from the Internet, a movie can use an active network connection to retrieve linked files, send information, open web pages, and perform many other network activities.
When Director streams a movie over the Internet, it first downloads the Score data and other nonmedia information such as scripts and the size of each cast member’s bounding rectangle. This data is usually quite small compared with the size of the movie’s media—usually only a few kilobytes.
Setting movie playback options To change basic streaming settings for a movie, you use the Movie Playback Properties dialog box. You can turn streaming on and off, specify a number of frames to download before playing the movie, and make Director display placeholders if cast members are not downloaded yet. The Movie Playback Properties dialog box also includes options for locking the current tempo. Leaving streaming off (the default setting) makes sense for some types of movies.
To set Shockwave playback options: 1 Select File > Publish Settings. The Publish Settings dialog box appears. 2 If not already selected, select Shockwave File (DCR) on the Formats tab. The Shockwave tab appears in the Publish Settings dialog box. 3 Select the Shockwave tab and select the options you want to provide for your users, as described in the following list: ■ Image Compression optimizes your content for download over the Internet by letting you manage the file size vs. the image quality a file.
About streaming with the Score and behaviors The easiest way to create a movie that streams well is to arrange the Score properly and use behaviors to control the playhead. Director downloads cast members in the order in which they appear in the Score. Try to arrange the Score so that events don’t make the playhead jump far ahead in the Score, where cast members have not yet been downloaded.
Checking whether media elements are loaded with Lingo or JavaScript syntax Director has several options that let an initial portion of a movie start playing as soon as the required data and cast members are available.
To execute a network script operation: 1 Start the operation. For example, the following statement initiates a text downloading operation and assigns the network ID returned by the getNetText() operation to the variable theNetID: theNetID = getNetText("http://www.thenews.com") 2 Make sure that the operation finishes. To check an operation’s status regularly until the method indicates that the operation is complete, use the netDone() method.
The gotoNetPage method is similar to the Director open method. It does not return a value. To preload a file from the server into the browser’s cache: • Use the preloadNetThing() method. For more information about this method, see the Scripting Reference topics in the Director Help Panel. The preloadNetThing() method initiates downloading a linked movie asset into the cache, where it is available for later use. Director can later preload the asset into memory without a download delay.
To determine the state of a network operation that retrieves data: • Use the Lingo on streamStatus event handler or the JavaScript streamStatus function. For more information, see the Scripting Reference topics in the Director Help Panel. Using Lingo or JavaScript syntax in different Internet environments Some Lingo or JavaScript syntax features behave differently, depending on whether the movie is playing back in a browser, as a projector, or within the authoring environment.
The following Lingo or JavaScript syntax supports URLs as references to external files. If you use this script in projectors or during authoring, you can avoid pauses while the file is being downloaded by first using preloadNetThing() to download the file. After the file has been downloaded, you can use these Lingo or JavaScript syntax elements with the file’s URL without a delay.
Interacting with browsers You can use setPref() or getPref() to read or write simple text preference files to the Prefs folder found in the Shockwave Player folder. To write to a preferences file on a local disk: • Use the setPref method. For more information about this method, see the Scripting Reference topics in the Director Help Panel. After the method runs, a folder named Prefs is created inside the Shockwave Player folder (in the same location as the Xtras folder).
• Run the movie on slow and fast connections; problems can arise from fast as well as slow connections. • Check for display problems on systems set to 8-, 16-, 24-, and 32-bit color. Also test as many • • types of monitors and display adapters as you can. Check for font mapping problems in your movie. If your movie uses nonstandard fonts, use embedded fonts. For more information, see “Embedding fonts in movies” on page 164. Check for sound problems, particularly if you stream sounds with SWA.
INDEX Numerics 3D behaviors about 327 action 330 applying 332 groups 333 library 328 triggers 329 types 328 3D Extruder tab (Property inspector) 324 3D Model tab, Property inspector 308 3D text 324 3D vectors 397 3D window, Shockwave 306 3D world boxes 330 collision properties and commands 394 defined 313 event handling 393 objects 315 3D Xtra 305 A accelerating sprites 85 accessibility captioning 433 features 427, 428 government requirements 427 keyboard navigation 429 scripting 434 Speech Xtra extension
appearance properties, MIAWs (movie in a window) 413 arranging sprites 58 ASCII values, keys 298 attaching behaviors 275 attributes, XML 424 audio.
boxes, text 178 brightness, changing 154 browsers cache, preloading 476 color palettes 155 HTML file options 456 Lingo and JavaScript support 478 preferences 479 previewing movies 448 Shockwave support 447, 448 status area 479 tips for 478 URLs, opening 475 Brush tool, Paint window 104, 107 Bucket tool, Paint window 103 Button component, Flash movies 207 buttons 292 C cache, preloading files 476 callbacks, Flash objects 194, 196 cameras commands 322 defined 314, 316, 335 group properties 363 manipulating 30
preferences 36 viewing 26 casts creating 23 defined 22 external 23, 47 internal, defined 23 opening in new window 29 preferences 34 properties 38 centimeters, specifying as unit of measure 168 Change Cast Member action 281 Change Cursor action 281 Change Ink action 281 Change Location action 281 Change Palette action 281 Change Tempo action 281 Changes Only sprite label option 62 channels behavior 277 behaviors 473 film loops 94 layering sprites 58 naming 12 selecting all sprites 54 sound 233, 236 Space to
Paste Relative command 97 sprites 69 corner points in vector shapes 137 creating 3D text 324 behaviors 279 bitmaps 100 cast members 24 casts 23 custom cast member thumbnails 34 custom tiles 120 editable text 172 external casts 47 fields 172 film loops 94 guides 66 hypertext links 171 libraries 48 MIAWs (movie in a window) 410 particle systems 330 projectors 460 sprites 52 text cast members 165 vector shapes 135 vectors 397 cropping videos 257 cross-platform features 12 cross-platform font mapping 173 cross-
protected formats 451 Publish command 452 testing 479 URLs 451 Xtra extensions 449, 450 dithering 114 dockable MIAWs (movie in a window) 414 docking Tool palette 18 dolly camera 330 downloading alternate image options 458 cast members 470 looping behaviors 473 speed 480 status, checking 474 streaming movies, options 471 using Lingo or JavaScript 474 Xtra extensions 449 dragging camera 330 drawing tools 17 drawRect property 412 Dropper tool, Paint window 103 dswmedia folder 244, 459, 477 duration of sprites
downloading, speed 480 importing 42 linking to 44 preloading 476 project management 441 projectors, options 455 types supported 44 URL references 478 Fill color, Paint window 111 fill settings for vector shapes 138 film loops 94, 95 filters, bitmaps 123 finding cast members 40 sprites 57 text 170 Fireworks bitmap compression settings 129 editing cast members 133 importing files into Director 131 First frame sprite label option 62 Flash asset commonPlayer 182 Flash Communication Server MX 13, 198 Flash compo
grid configuring 67 positioning sprites 66 properties, setting 18 grouping Cast panels 27 groups commands 323 defined 314, 316 methods 364 parameters 333 properties 363 guides color 66 positioning sprites 66 properties, setting 18 Guides tab on Property inspector 18 H Hand tool, Paint window 103 handlers anti-aliasing, turning on and off 311 behaviors 281 callback 196 events 394 Lingo or JavaScript events 393 MIAWs (movie in a window) 416 on getPropertyDescriptionList 284 scripts 393 handles 135 handwriting
speed 480 streaming movies 470 introduction to Director 11 Invert colors, Paint window 111 italic text 167 joining curves, vector shapes 140 sprites 70 JPEG files, importing 100 jumping 293, 473 J JavaScript syntax 3D text methods and properties 325 animating sprites 97 assigning cast members to sprites 80 behaviors, writing 281 bitmap controls 114 browser support 478 cast member properties, changing 49 cursor location detection 297 downloading files 474 editable sprites 295 Flash movies 185 handlers 393
model interactions 316 overview 382 properties 383 Property inspector 309 text 325 line settings for vector shapes 138 line spacing, adjusting automatically 168 Linear tweening option 88 lines, Paint window tools 105 Lingo syntax 3D text methods and properties 325 animating sprites 97 assigning cast members to sprites 80 behaviors, writing 281 bitmap controls 114 browser support 478 cast member properties, changing 49 cursor location detection 297 downloading files 474 editable sprites 295 Flash movies 185
sounds, importing 231 textures 360 unloading cast members 47, 437, 439 Xtra extensions 449 Memory inspector 438 mesh deform modifier 380 mesh generator 339, 342 messages, sending to sprites 287 methods ActiveX 205 Bones player 373 cameras 390, 396 collision 395 downloading files 475 event handling 394 keyframe animation 377 lights 384 models 349 rendering 407 sprites 408 textures 362 transforms 399, 401 vectors 398 MIAWs (movie in a window) appearance properties 413 browsers, not supported 478 closing 411 c
movies accessibility 427, 428 browsers, playing in 478 browsers, previewing in 448 captioning 433 changing color depth of 147 color modes 146 color palettes, changing 149 cursors, animated color 301 disks 452 distribution formats 451 examples of 12 exporting as digital video 465 exporting QuickTime 466 external casts 47 Flash 181 fonts, embedding 164 importing Director within Director 202 linked media 45 linked, properties 203 local connection object 195 local network distribution 452 old versions, opening
O object-relative model movement 351 objects 3D 315 Flash 193 local connection 195 MIAWs (movie in a window) 410 renderer services 403 scripts 393 vector 397 offscreen graphics buffer 308 old versions converting movies 459 opening movies 28 Update Movies command 464 on getPropertyDescriptionList handler 284 onion skinning 125 online help 13 opening casts in new windows 29 MIAWs (movie in a window) 410 old movies 28 optimizing cast members 133 Options Menu, Cast panel 27 organizing files 441 movies 468 outli
Play Cast Member action 281 play done method 294 Play Every Frame digital video property 246 Play External File action 281 play method 294 Playback options, Shockwave 471 playhead behaviors 473 jumping behaviors 473 markers 330 sprites, extending 70 playing DVD-Video 12 playing Flash movies 188 PNG images, importing 131 pointers, mouse behaviors 280 click detection 294 cursor colors, animating 298 Flash movies 186 location detection 297 rollovers 296, 331 trigger behaviors 329 points adding 139 creating 137
Guides tab 66 Guides tab, Stage 18 Member tab 22, 39 MIAWs (movie in a window) 415 Movie tab 146 new features 304 sprites 59 Stage 18 Text tab 324 protected movies 451 public actions 330 public behaviors 328 Publish settings changing 453 default 452 Files tab 455 Formats tab 454 HTML 456 Image tab 458 Projector tab 455 Shockwave tab 456 publishing 12 purgePriority 437 push buttons 292 Q QuickTime controlling with Lingo 250 exporting options 466 importing files 43 masks 250 QuickTime VR inserting 251 panning
preferences 20 searching for cast members in 41 sound controls 233 Space to Time command 93 sprite display settings 20 sprite labels 62 sprites, viewing by name 56 streaming movies, behavior 473 tempo 157 windows, using multiple 19 screen resolution for graphics 100 Script window, creating cast members in 26 scripting ActionScript instructions 190 editing 29 handlers 393 JavaScript syntax 12 preview option 20 showing in Cast window 37 scripts, behavior inheritance 288 scroll bar, displaying on Stage 175 scr
controlling with Lingo or JavaScript 239 importing 231 Lingo and JavaScript controls 235 looping 234 playing external 239 Shockwave Audio 237 streaming Shockwave Audio 238 streaming, formats supported 232 synchronizing with cue points 240, 259 transitions, playing during 161 Windows issues 234 WMA files 236 sourceRect property 412 Space to Time command 93 spacing, lines 168 Speech Xtra 428, 435 speech, converting text to 428, 431, 434 speed downloading 480 Lock Frame Durations 159 network operations 470 par
guides and grid 18 moving sprites 69 positioning sprites 65 Property inspector 18 rendering methods 309 Sprite Overlay 61 sprite preference 52 sprites, viewing by name 56 Standard Import option 43 step recording 96 Storyboard Format 445 streaming controlling with Lingo or JavaScript 474 Flash movies 187 loading status, checking 474 movies 469 playback options 471 score-based 473 Shockwave Audio 237, 238 sound, formats supported 232 WMA files 236 strings, checking 179 stroke settings for vector shapes 138 su
Transparent ink 79 trigger behaviors defined 328 groups 333 parameters 333 viewing 328 troubleshooting color palettes 154 resources 445 testing movies 443 Truncate Sprites Being Pasted option 21 tunnel depth 325 Tweak window 66 tweening bitmap filters 124 defined 83 paths 84 properties 84 settings, changing 88 speed 85 sprite properties 86 sprites 83 tips 87 U unlinking external casts 47 unloading cast members 47, 437, 439 unlocking sprites 63 Update Movies command 464 updating movies from older versions 45
workspace customizing 12 world-relative model movement 351 wrapping, text 178 X XML about 419 attributes 424 character sets 425 data, sending from Flash to Director 193 nodes 422, 424 parser objects 420, 424 websites, resources 420 white space, ignoring 425 Xtra extensions 3D 305 Auto Filter command 124 bitmap filters 123 cast member properties 49 cursor animation support 299 distributing movies 449, 450 excluding from projectors 462 included 449 linked media 45 properties 39 Speech 428, 435 transitions 161