Using Director MX Macromedia Director MX
Trademarks Afterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware Attain, Authorware Interactive Studio, Authorware Star, Authorware Synergy, Backstage, Backstage Designer, Backstage Desktop Studio, Backstage Enterprise Studio, Backstage Internet Studio, Contribute, Design in Motion, Director, Director Multimedia Studio, Doc Around the Clock, Dreamweaver, Dreamweaver Attain, Drumbeat, Drumbeat 2000, Extreme 3D, Fireworks,
CONTENTS INTRODUCTION Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installing Director . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What’s new in Director MX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Add navigation buttons to the animation scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Build the sound and video scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Write Lingo scripts to control movie playback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Add Lingo to navigation buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Write Lingo that refers to scenes . . . . . . . .
CHAPTER 5 Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Creating sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing sprite preferences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setting bitmap cast member properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Setting PICT cast member properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Setting Paint window preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Compressing bitmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Working with Macromedia Fireworks . . . . . .
CHAPTER 11 Using Flash and Other Interactive Media Types . . . . . . . . . . . . . . . . . . . . . . 293 Using Flash Movies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Editing a Flash cast member . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlling a Flash movie with Lingo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Controlling a Flash movie’s appearance with Lingo . . . .
CHAPTER 14 Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Attaching behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Changing the order of attached behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Getting information about behaviors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 17 3D Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 What you need to know . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . From 2D to 3D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The 3D Xtra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 20 Controlling the 3D World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 3D Lingo events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 Collisions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 Vector math. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CHAPTER 26 Packaging Movies for Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571 Shockwave browser compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571 Previewing a movie in a browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 About Xtra extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents
INTRODUCTION Getting Started Macromedia Director MX is the world’s foremost authoring tool for creating interactive multimedia. Developers rely on Director to create attention-grabbing business presentations, advertising kiosks, interactive entertainment, and educational products. To see some of the exciting and varied ways in which developers use Director, visit the Director showcase at www.macromedia.com/software/director/special/inspiration/. You can also see great examples of Shockwave at www.
Installing Director Follow these steps to install Director on either a Windows or a Macintosh computer. To install Director on a Windows or a Macintosh computer: 1 Insert the Director CD into the computer’s CD-ROM drive and do one of the following: • In Windows, if the installation program doesn’t start automatically, choose Run from the Windows Start menu, type d:\setup.exe (where d is your CD-ROM drive letter), and click OK. • On the Macintosh, double-click the Director Installer icon.
Macromedia Flash MX importing lets you take advantage of the power of Flash MX and its lightweight vector graphics by importing Flash files into Director MX content. Director developers can use this powerful combination to create the most effective multimedia content. Macromedia Flash Remoting MX provides a secure, high-performance connection between Macromedia ColdFusion MX and Shockwave Player. When used with Director MX, Flash Remoting MX lets you easily pass data to ColdFusion MX and back.
An Object inspector with data browser functionality lets you inspect all properties of script instances, and examine the hierarchy of elements inside 3D cast members and Flash MX sprites. The ability to quickly examine and modify all your movie components reduces both debugging and development time. Color-coding of recently changed variables makes tracking changes quick and easy with immediate visual feedback.
Director MX Lingo Dictionary The Director MX Lingo Dictionary is a printed version of all the Lingo topics in Director Help. Answers panel The Answers panel provides quick access to information that helps you work effectively with Director. This includes tutorials, TechNotes, and other useful content. You can get the latest Director information from macromedia.com by simply clicking the Update button in the Answers panel.
Conventions used in Director Help and printed books The help system and printed books use the following conventions: • The terms Lingo and Director refer to Director MX. • Within the text and in Lingo examples, Lingo elements and parts of actual code are shown in this font. For example, set answer = 2 + 2 is a sample Lingo statement. • Quotation marks that are part of Lingo statements are shown in the text and Lingo code examples as straight quotation marks (") rather than as curly quotation marks (”).
CHAPTER 1 Director Basics Macromedia Director MX is the tool of choice for legions of web and multimedia developers. With Director, you can create movies for websites, kiosks, and presentations as well as movies for education and entertainment. Movies can be as small and simple as an animated logo or as complex as an online chat room or game. Director movies can include a variety of media, such as sound, text, graphics, animation, and digital video.
Introducing the Director workspace When you first launch Director, there are several windows in the default layout, including the Stage, the Score, the Cast, and the Property inspector. Stage Tools Cast Property inspector Score Default Director MX window layout (Windows platform) When creating and editing a movie, you typically work in four of these windows: the Stage, the Score, the Cast, and the Property inspector. The Stage If the Stage is not open, select Window > Stage.
To scroll around the Stage, do one of the following: • Use the scroll bars. (To show or hide Stage scroll bars, select Edit > Preferences > General and select or deselect Show Stage Scrollbars.) • Select the Hand tool from the Tool palette and drag inside the Stage to reposition the visible portion. • Bring the Stage to the front, hold down the Spacebar to temporarily switch to the Hand tool, and then drag inside the Stage to reposition the visible portion.
The floating (detached) Control panel displays tempo information that does not appear when the Control panel is attached to the Stage. For more information about tempo, see “About tempo” on page 267. Actual tempo Tempo Setting The floating Control panel To close the floating Control panel, do one of the following: • Select Window > Control Panel. • Press Control+2 (Windows) or Command+2 (Macintosh). Note: After you close the floating Control panel, you can use these same instructions to reopen it.
You can control the Score by zooming to reduce or magnify your view and by displaying multiple Score windows. You can also control the Score’s appearance by selecting Edit > Preferences > Score. Score Playhead Keyframe Sprite in Score The Cast window If the Cast window is not visible, select Window > Cast. In the Cast window, you can view your cast members, which are the media in your movie, such as sounds, text, graphics, and other movies.
The Property inspector If the Property inspector is not visible, select Window > Property Inspector. The Property inspector provides a convenient way to view and change attributes of any selected object, or multiple objects, in your movie. After you select an object, relevant category tabs and associated fields appear in the Property inspector. If you select multiple objects, only the information that is common to all the selected objects appears.
The following illustrations show different information that appears in the Property inspector, depending on what is selected. In the first illustration, a sprite is selected. In the second illustration, a cast member is selected. To show more or less information in the Property inspector: • Click the expander arrow in the Property inspector.
The following illustrations show different information appearing in the Property inspector depending on whether the expanded information is hidden or shown.
Setting Stage and movie properties You use the Property inspector’s Movie tab to specify settings that affect the entire movie, such as how colors are defined, the size and location of the Stage, the number of channels in the Score, copyright information, and font mapping. These settings apply only to the current movie, whereas the settings you select from Edit > Preferences apply to every movie. To set Stage and movie properties: 1 Click the Movie tab in the Property inspector in Graphical view.
6 To select a color palette for the movie, select a palette from the Palette pop-up menu. This palette remains selected until Director encounters a different palette setting in the Palette channel. For a complete discussion of color palettes and using color in Director, see “Controlling color” on page 255. 7 To determine how the movie assigns colors, select either RGB or Palette Index. RGB makes the movie assign all color values as absolute RGB values.
When you change the size of the Stage, any guides or grids you use to assist you with alignment will also scale to the zoomed size, and you can manipulate Stage objects in the same way that you would on a Stage that is not zoomed. To zoom the Stage, do one of the following: • Press Control+the Plus (+) key (Windows) or Command+the Plus (+) key (Macintosh) to zoom in and increase the Stage size.
About channels in the Score Channels are the rows in the Score that control your media. The Score contains sprite channels and special effects channels. Sprite channels are numbered and contain sprites that control all visible media in the movie. Effects channels at the top of the Score contain behaviors as well as controls for the tempo, palettes, transitions, and sounds. The Score displays channels in the order shown in the following figure.
To turn off a Score channel: • Click the gray button to the left of the channel. A darkened button indicates that the channel is off. This channel is on This channel is off To turn multiple Score channels off and on: • Press Alt (Windows) or Option (Macintosh), and click a channel that is on to turn all the other channels off, or click a channel that is off to turn the other channels on.
About the playhead The playhead moves through the Score to show the frame currently appearing on the Stage. As you play your movie, the playhead automatically moves through your Score. You can also click any frame in the Score to move the playhead to that frame, and you can drag the playhead backward or forward through frames. Frame numbers Playhead Changing your view of the Score To narrow or widen the Score, you change the zoom percentage.
• Select an option on the Zoom pop-up menu to the right of the Score. Zoom pop-up menu Score zoomed out to 50% Score at 100% Score zoomed in to 200% You can also display more frames in a Score without changing the zoom setting. To do so, place a sprite in the rightmost frame of the Score. Director automatically displays additional frames in the current view of the Score.
Using context menus To let you quickly access certain commands, Director provides context menus that display commands that are relevant to a particular element. These menus are called context menus because the commands on the menu vary, depending on the context in which the menu appears. In the following illustration, Director shows the context menu for a sprite. To display a context menu: • Position your mouse pointer over an element and then right-click (Windows) or Control-click (Macintosh).
The following is a list of document windows in Director MX. • • • • • • Stage Score Cast Script Message Media editors (Paint, Vector Shape, Text, Field, QuickTime, Shockwave 3D, RealMedia, AVI Video) The following is a list of tool windows.
Panels have the following features: a header bar that displays the name of the panel, a title bar, an expander arrow to collapse and expand panels, a panel gripper to dock and undock panels, and an Options menu for managing panels. Title bar Header bar Options menu Expander arrow Panel gripper Note: The Stage and Control panel do not have header bars, and the Stage, Control panel and Tool palette do not have Options menus.
To hide all panels: • Select Window > Hide Panels, or press the F4 key on your keyboard. Repeat this command to show all panels. Note: The Hide Panels menu command hides all floating (non-docked) tool windows and all docking channels (Windows only). Document windows (such as the Stage, Score, and Script windows) are unaffected. For more information on the difference between document and tool windows see “Window types” on page 34.
To dock a panel or panel group: • Drag the panel or panel group by its gripper over another panel or panel group, or (in Windows only) over a docking channel. Panel gripper As you drag the panel over a docking area, a placement preview line or rectangle shows where it will be placed among the panel groups. To undock a panel group: • Drag the panel group by its gripper until its outline indicates that it’s no longer docked. Document windows float over the View Port when the docking channels are open.
To group a panel with another panel or panel group: 1 Select a panel or tab within a panel group. 2 From the panel’s Options menu, select Group [panel name] With, and then select a panel or panel group name from the submenu that appears. To remove a panel (tab) from a panel group: 1 Select a tab within a panel group. 2 From the panel group’s Options menu, select Group [panel name] With, and then select New Panel Group from the submenu that appears.
Using panel Options menus Each 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 panel’s Options menu: 1 Expand the panel, if necessary, by clicking the panel’s expander arrow or the title next to the expander arrow. 2 Click the Options menu control in the upper right of the panel, and select the desired menu item.
Using multiple Score windows You can view and work in different parts of a movie at the same time by opening additional Score windows. If your sprite bars occupy many frames in the Score, for example, you can open a second Score window to work on another place in the movie without scrolling. You can also drag sprites from one Score window to another. To open a new Score window: 1 Activate the current Score window. 2 Select Window > New Score Window.
Using markers Markers identify fixed locations at a particular frame in a movie. You use markers when you’re defining navigation. Using Lingo or draggable behaviors, you can instantly move the playhead to any marker frame. This is useful when jumping to new scenes from a menu or looping while cast members download from the web. You can also use markers while authoring to advance quickly to the next scene.
To enter marker comments: 1 Move the playback head to a marker, and select Window > Markers. The Markers window opens and displays comments associated with that frame. Comments Marker names Comments associated with markers appear in the right column. By default, the marker name appears as the first line of text in the comments column and should not be removed.
3 If you want to delete frames, select Edit > Clear Sprites, or press the Delete key on your keyboard. If you cut, clear, or delete the selected frames, Director removes the frames and closes up the empty space. Note: To delete a single frame, you can also select Insert > Remove Frame. 4 To paste frames that you have cut or copied, select any frame or sprite, and select Edit > Paste Sprites.
Director includes a set of prepackaged Lingo instructions, called behaviors, that you can simply drag to sprites and frames. Behaviors let you add Lingo’s interactivity without writing Lingo scripts. You can modify behaviors or create your own. For more information about the behaviors included with Director, see “Using Director Behaviors” in the Director Support Center at www.macromedia.com/support/director/lingo/d8/d8behaviors.html.
Setting general preferences To control some of the Director default settings for the Stage and the user interface, you can use the General Preferences dialog box. These settings control the appearance of movies only in the authoring environment, not during playback. To set Director default values: 1 Select Edit > Preferences > General. 2 To specify the default size and location of the Stage and the way it animates when deactivated, select Stage options.
Choosing Internet connection settings Director can connect to the Internet to import cast members and retrieve data. Use settings in the Network Preferences dialog box to control how the connection works and to define a preferred browser. To select Internet connection settings: 1 Select Edit > Preferences > Network.
Printing movies You can print movie content to review it and mark changes, to distribute edits to a team, to make handouts from a presentation, or to see your work on paper. You can print a movie while in authoring mode in several ways.
5 To determine the layout of the items to print, click Options and select from the following: Scale provides options to print at 100%, 50%, or 25% of the original size. creates a border around each frame. Frame Borders Frame Numbers prints the frame number with each frame. Registration Marks places marks on every page to align the page for reproduction. Storyboard Format is available only when you select 50% or 25% images to print. This option places marker comments next to the frame image.
3 To remove all purgeable items from RAM, including all thumbnail images in the Cast window, click Purge. All cast members that have Unload (purge priority) set to a priority other than 0–Never (as specified in the Property inspector’s Member tab) are removed from memory. This procedure is useful for gaining as much memory as possible before importing a large file. Edited cast members are not purged.
• Transition Xtra extensions supply transitions in addition to the predefined transitions that are available in the Frame Properties: Transition dialog box. • Tool Xtra extensions provide useful functions in the authoring environment, but they don’t do anything while a movie runs. They do not have to be distributed with movies. About installing Xtra extensions To make custom Xtra extensions available to Director, place them in the Xtras folder located in the same folder as the Director application.
Answers panel The Answers panel provides quick access to information that helps you work effectively with Director, including TechNotes, articles, and other useful content. To open the Answers panel: • Select Window > Answers. To get the latest Director information from macromedia.com: • Click the Update button.
CHAPTER 2 Director MX Basics Tutorial The Director Basics chapter of Using Director introduces you to the Macromedia Director MX user interface and basic Director concepts; you’ll gain a greater understanding of the material presented in this tutorial if you’ve first read Chapter 1, “Director Basics,” on page 19. This tutorial reiterates and expands on much of that information while it guides you through the process of creating a simple interactive movie with animation, sound, and video.
About the Director metaphor The Director user interface is designed around a movie metaphor. Each project you create can be thought of as a movie, with a cast of characters, a score, a stage where the action takes place, and a director (you, the author). Each media element that appears in your movie (sound, video, images, text, buttons, and so on.) can be thought of as a member of the movie’s cast. In Director, the Cast window is where you view the list of media elements that appear in your movie.
View the completed movie You can view a completed version of the tutorial movie to become familiar with how your finished movie will appear. 1 Launch Director and select File > Open. Within your Director MX application folder, browse to Tutorials/Basics/Finished and double-click the Basic_finished.dir file. 2 If windows obscure the Stage, drag them out of the way. 3 To play the movie, click Play along the bottom of the Stage, or select Control > Play.
Set up the movie You can now arrange your workspace and set properties for your movie, such as the Stage size and color, and the number of channels in your Score. During the authoring process, you view Director movies on the Stage window. You can set up the size and color of the Stage window. 1 In the Property inspector (Window > Property Inspector), click the Movie tab. If the Property inspector is not in graphical mode, as shown in the following illustration, click the List View Mode icon to deselect it.
4 In the Property inspector, select a dark orange color from the Stage Fill color picker. Stage Fill color picker 5 Save your movie by selecting File > Save or clicking the Save button in the toolbar (Window > Toolbar).
View your cast members To create a Director movie, you need cast members. Cast members are the objects that appear on the Stage and in the Score. Some of these elements might be text, graphics, sound, video, or Lingo scripting behaviors. The movie you create in this tutorial consists of three scenes. Some cast members appear in more than one scene, and some appear in one scene only. First, use the Cast window to view your current set of media. Next, you’ll begin adding new cast members.
Edit a text cast member The first cast member you will use in your movie is the text cast member containing the words “Director Basics.” You’ll edit the text to give it a more appealing graphic design. 1 Double-click the text cast member in the first slot of the Cast window. The Text window opens. Cast Member Name Size Italic Bold You use the Text window to edit text cast members. You’ll find that most Director cast member types have associated windows that you can use to view and edit the cast member.
4 Give the text cast member a name by clicking in the Cast Member Name text box at the top of the window and typing TitleText. Press Enter (Windows) or Return (Macintosh). 5 Close the Text window, and save your movie. The next section guides you through the process of building the first scene of your movie and creating a new cast member for the scene. Build the first scene Building a scene in Director requires creating or importing the cast members for the scene, and placing sprites on the Stage.
2 In the Cast window, click the TitleText cast member and drag it anywhere on the Stage to create a sprite from the TitleText cast member. The background of the new text sprite is white. 3 Click the new text sprite on the Stage to select it. On the Sprite tab in the Property inspector, select Background Transparent from the Ink pop-up menu. Inks control the way a sprite color appears on the Stage. Background Transparent ink makes the white background of the sprite appear transparent.
Add buttons to the Stage In addition to the title text, the first scene of your movie will contain two buttons. You’ll add the first button to the Stage, then you’ll create a new button on the Stage to complete the scene. You begin by giving the button cast member in the second slot of the Cast window a name. Earlier, you named the TitleText cast member by entering a name in the Text window. You can also give cast members names directly in the Cast window. 1 Click the button cast member in cast slot two.
Remember that button cast members contain special functionality to automatically highlight when clicked. Creating button cast members in Director is different from creating most other cast members. Cast members are often created in separate windows and then dragged from the Cast window to the Stage. You create a button cast member directly on the Stage using the Tool palette. You’ll use the Button tool to create a new button. 1 On the Tool palette (Window > Tool Palette), click the Push Button tool.
3 When you release the mouse button, the rectangle you created becomes an editable text box in which you enter the text that you want to appear on your button. Type Go to Sound and Video in the text box. 4 To place the button precisely, in the Property inspector, type 242 in the X text box and type 161 in the Y text box. Press Enter (Windows) or Return (Macintosh). 5 Click the Stage outside the button. The editable text box changes to a completed button sprite.
1 In the Score window, click the end of the TitleText sprite in frame 28, and drag it to the left to frame 10. Note: You can also lengthen sprites by dragging their end frames to the right to higher-numbered frames, and you can edit more than one sprite at the same time by selecting multiple sprite end frames. 2 Click the Animation button sprite in channel 2 of the Score. 3 Shift-click the SoundVideo sprite in channel 3. 4 Click frame 10 in the frame number bar above channel 1.
Create an animation The second scene of your movie will contain a simple animation of a sunset. The sun will set behind a mountain range, and a cloud will move across the sky. You’ll make three of the cast members for this scene, arrange their sprites in the Score, and create the animation of the sun. This scene will also include a new button that returns users to the first scene.
When you place new sprites on the Stage, Director puts them into the first available channel in the Score. Because there were no other sprites in frame 15, the Mountain sprite appeared in channel 1. Later you will make changes to the order in which the sprites appear in the Score channels. Name a cast member The mountain cast member has not yet been named. Naming cast members makes it easier to identify the sprites in the Score. • In the Cast window, select the mountain cast member in cast slot 4.
3 In the Paint window toolbar, select the Pencil tool. Select an orange color from the Foreground Color pop-up menu. Eraser tool Paint Bucket tool Pencil tool Foreground Color pop-up menu 4 Select the one-pixel line width from the list of line widths at the bottom of the left-side Paint window toolbar. Gradient start color Gradient end color One-pixel line 5 68 In the Paint window, draw a small, flat cloud with the pencil tool. Be sure that the cloud has no gaps in the outline.
Fill the shape with color After you’ve drawn the cloud outline, you can fill it with color. Because this is an animation of a sunset, the cloud will have an orange gradient. A gradient is a smooth blending of one color into another. To create the gradient, you use the Paint Bucket tool and the Gradient ink. 1 Select the Paint Bucket tool from the toolbar in the Paint window. You use this tool to fill enclosed lines. 2 Select an orange color from the Gradient Start color box.
5 With the Paint Bucket tool still selected, click inside the outline of the cloud. The cloud fills with an orange gradient. Cast Member Name text box 6 Click the Cast Member Name text box at the top of the Paint window, type Cloud in the text box, and then press Enter (Windows) or Return (Macintosh). 7 Close the Paint window. Next you’ll create a different kind of cast member for the Sun in your animation scene.
1 Select Window > Vector Shape, and select the Filled Ellipse tool in the toolbar on the left side of the window Filled Ellipse tool Stroke Width pop-up menu Gradient color boxes 2 Select 0 point from the Stroke Width pop-up menu. 3 Drag the pointer in the window to make a circle. 4 Click the first Gradient Color box, on the left, and select a bright shade of yellow. This will be the beginning color of the gradient on the sun.
5 Select a very light orange from the second Gradient Color box. This will be the ending color of the gradient. 6 Click Gradient, below the Gradient Color boxes. 7 The gradient fill in the circle changes color from left to right. To rotate the gradient so it changes from top to bottom, enter 90 in the Angle text box at the top of the window. 8 Click the Cast Member Name text box at the top of the window and type Sun. Press Enter Windows) or Return (Macintosh).
Animate the cloud You are now ready to add the cloud to the scene and create an animation of it moving across the sky. You can do this by placing a sprite of the Cloud cast member on the Stage, and then using a technique called tweening. 1 If the playhead is not already on frame 15, the beginning of the second scene, click frame 15 in the frame number bar at the top of the Score. 2 Make sure the Cast and Stage windows are open. Drag the Cloud cast member from the Cast window to the Stage window.
4 The new Cloud sprite has a bounding box around it and a round dot in the middle. Click and drag the round dot in the middle of the cloud to the right edge of the Stage. A line connects the original location of the cloud to the new location of the dot. There is still a dot in the middle of the Cloud sprite, but it is a different color from the dot that you dragged. You have performed your first tweening operation.
Change the tempo of an animation To create a slower tempo for the sprite, you can extend the sprite in the Score. 1 Click the end frame of the Cloud sprite in frame 24 of the Score, and drag it to frame 50. 2 To see the slower animation this creates, drag the playhead back and forth from frame 15 to frame 50 in the Score. The cloud moves more slowly across the Stage. The Mountain sprite disappears from the Stage when you drag the playhead to frames 25 through 50.
4 Drag the dot in the middle of the Sun sprite downward, in a slight diagonal toward the left, to the bottom of the Stage. A line appears, connecting the dots. This line is the sun’s tweened animation path. 5 Click the end frame of the Sun sprite in frame 24 of the Score, and drag the end frame from frame 24 to frame 50. 6 Drag the playhead back and forth from frame 15 to frame 50. The sun and the cloud animate, but the animation requires modification.
4 Click and drag the Sun sprite from channel 4 to channel 1, but make sure it remains in frames 15 through 50. 5 Scrub or drag the playhead from frame 15 to 50 to see the modified animation. The Sun sprite now appears behind the mountains and cloud. Add navigation buttons to the animation scene You’ve successfully completed your first animation. To complete the animation scene, you’ll add navigation buttons.
Add a new button Next, you create a new button that returns users to the first scene. 78 1 Click frame 15 in the frame number bar in the Score to move the playhead to that frame. 2 In the Tool palette (Window > Tool Palette), click the Push Button tool. 3 Drag a horizontal rectangle to the lower left area of the Stage, and release the mouse button. 4 In the button text box, type Go to Start, and then click the Stage outside the button.
Arrange sprites in the Score To make the Score easier to read, arrange the sprites of the animation scene in the Score so there is an empty channel between the graphic sprites and the button sprites. 1 Select both the SoundVideo and GoStart sprites, which begin in frame 15, in the Score by Shift-clicking them. 2 Drag the two sprites down one channel so they occupy channels 5 and 6. Be sure not to move them left or right. The sprites should still occupy frames 15 through 50.
Import a cast digital video member So far, all the cast members you’ve used have been created and stored within your Director movie file. The buttons, graphics, and text are part of the Director file. It is common to import files from outside Director, too. When you import files into Director, you can import the entire file into your Director movie file or leave it as a separate file, creating only a reference to the external file in your Director movie.
1 Double-click the digital video cast member in the Cast window. The QuickTime window opens. Playhead Play 2 Fast forward Rewind Play the video using the controls at the bottom of the QuickTime window: • Click the Play button in the lower left corner of the window. The video begins playing, and the Play button changes to a Pause button. • To pause the video, click the Pause button in the lower left corner of the window. The video pauses, and the Pause button reverts to a Play button.
Create a QuickTime sprite You are now ready to place the QuickTime sprite on the Stage. The sound and video scene should start in frame 55. 1 Click frame 55 in the frame number bar in the Score. The playhead moves to frame 55. 2 Drag the Ouch! QuickTime cast member to the upper left corner of the Stage. The new sprite appears on the Stage and in the Score in channel 1, frames 55 through 64.
Add buttons to the Stage Next, you’ll add buttons that control playback of the QuickTime sprite. These buttons are already included in the Cast window in cast slots 9, 10, and 11. Unlike the Director Button cast members, these cast members are bitmap graphics that don’t include automatic button functionality. Later you’ll add Lingo to the buttons to make them control the QuickTime sprite.
3 To place the Pause button on the Stage, verify that frame 55 is selected, and drag the Pause button from the Cast window to the left side of the Stage window, directly beneath the QuickTime sprite and to the right of the Play button. Again, precise placement isn’t necessary yet. The Pause button’s sprite appears on the Stage and in channel 3, frames 55 through 64, of the Score.
Import a sound The QuickTime movie has no soundtrack. You can make the scene more interesting by adding sound to accompany the video. The easiest way to add sound to a Director movie is to import a sound cast member and place it in one of the sound channels in the Score. Whenever the playhead plays frames that include sound sprites, the sound plays. You can also play sounds by using Lingo instead of the sound channels, which you’ll learn in the Lingo section of this tutorial. 1 Select File > Import.
1 If the effects channels that appear above the frame number bar in the Score are not visible, click the Hide/Show Effects Channels button in the upper right corner of the Score. The effects channels appear. Sound channels Click frame 55 in the frame number bar in the Score. With the Cast window and Score open, drag the drumloop cast member from the Cast window to frame 55 in sound channel 1. The sound is now ready to play when frames 55 to 64 of your movie play. 2 Rewind and play your movie.
Add navigation buttons The last sprites that you’ll add to the sound and video scene are the navigation buttons. You’ll then be ready to add simple Lingo, the Director scripting language, to all the buttons. The sound and video scene needs a button that returns users to the start scene and a button that’s linked to the animation scene. You already have each of these buttons in the Cast window and in the Score. You’ll use two slightly different techniques to place these buttons in the sound and video scene.
3 On the Stage, click the Animation button to select it. Use the Sprite tab in the Property inspector (Windows > Property Inspector), as you did earlier, to give the button x- and ycoordinates of 220 and 298, respectively. Note: As you complete the tutorial, remember to save your work frequently. Each scene of your movie is graphically complete. You are now ready to add Lingo to the buttons, to let users navigate through the movie.
Each script you write is composed of handlers. A handler is a set of Lingo commands that handle a specific event, such as the exitFrame event. Some scripts have only one handler and some have multiple handlers. Each handler begins with the name of the triggering event, such as exitFrame, and ends with the word end. Write a handler In this section, you’ll write a simple handler. The following discussion describes the script. 1 Open the Score (Window > Score) if it is not already open.
Reuse the handler You’ll use the same script cast member in the last frame of your movie, frame 64. With the Cast window and Score open, drag the Loop script from cast slot 13 to frame 64 in the script channel of the Score. A new sprite for the script appears in frame 64. Notice that the default length of script sprites is one frame. Now the same looping effect takes place in frame 64 so that the movie keeps playing until the user clicks a button in the sound and video scene.
2 In the markers channel to the right of the marker menu in the Score, click frame 15. Marker menu Markers channel A new marker appears in the marker bar in frame 15. 3 Type Animation in the text box next to the new marker, and press Enter (Windows) or Return (Macintosh) to name the marker. Note: As you complete the tutorial, remember to save your work frequently.
Add Lingo to navigation buttons To make the navigation buttons function, you need to add scripts to the buttons. You’ll write scripts attached to the button sprites, rather than to frames in the script channel. Your frame scripts respond to exitFrame events. Your button scripts will respond to mouse clicks. You start by adding scripts to the buttons in the start scene. 1 In the Score, right-click (Windows) or Control-click (Macintosh) the Animation button sprite in channel 2, frames 1 through 10.
Add markers to two additional scenes Your first button is complete. To use similar scripts on the remaining navigation buttons, you can add markers to the start scene as well as the sound and video scene. 1 In the Score, click the marker bar in frame 1, the first frame of the start scene. A new marker appears. 2 In the text box next to the new marker, type Start, and press Enter (Windows) or Return (Macintosh).
Add scripts to the animation scene The animation scene contains two buttons: the Go to Start button and the Go to Sound and Video button. Because you’ve already written a script for the Go to Sound and Video button, you can reuse it. For the Go to Start button, you need to write another new script. 1 With the Cast window and the Score open, drag the GoSndVid script cast member from the Cast window onto the SoundVideo button sprite in channel 5, frames 15 through 50, of the Score.
Digital video movies use a timeline instead of a Score. The timing of the video playback is tied closer to the soundtrack of the video. For example, if the video has a soundtrack, the timing of the video and sound must remain synchronized during the entire playback of the video. For this reason, digital videos will skip frames if necessary to keep up with the soundtrack. On slower computers, several frames might be skipped during video playback. This kind of animation is called time-based.
6 In the name text box at the top of the script window, type RewindScript. Close the Script window, and save your movie. The Lingo you typed in this handler uses a different syntax than the scripts you wrote earlier. When you write Lingo that manipulates properties of objects such as sprites or cast members, you use dot syntax. Dot syntax is a way of writing Lingo that separates properties from their objects with dots instead of words such as the and of.
Add a script that pauses the QuickTime sprite When the video is paused, the movieRate is 0. You can play a video at faster than normal speed by using numbers greater than 1 and at slow speed by using numbers less than 1. 1 In the Score, right-click (Windows) or Control-click (Macintosh) the Pause button sprite in channel 3, frames 55 through 64, and select Script from the context menu. 2 On the second line of the handler in the Script window, type the following Lingo: sprite(1).
Modify the script for the Pause button Now you need to modify the PauseScript Lingo so that the sound pauses when the user clicks the Pause button to pause the video. 1 In the Cast window, select the PauseScript cast member, and click the Cast Member Script button at the upper right of the window. The Script window opens with the PauseScript displayed. 2 Place the insertion point at the end of the second line of the handler that reads: sprite(1).
Import the new sound cast member This sound file is small; there is no compelling reason not to import the file directly into your Director file. 1 In the Cast window, select the first empty cast member slot, which should be slot 21, and select File > Import. 2 In the Import dialog box, navigate to the Sounds folder on the same level as your Director file. Select the button.wav file in the Sounds folder, and click Add.
Use a QuickTime Xtra Xtra extensions are software components that extend the functionality of Shockwave movies and projectors. A QuickTime Xtra is necessary to ensure your QuickTime movie plays correctly when published. When you imported the Ouch! QuickTime movie, Director automatically added the QT3 Asset Xtra to the Xtra extensions list for your movie. You’ll now select the Xtra from the list to make it available to your users. 1 Select Modify > Movie > Xtras.
Change Publish settings and publish your movie When you use the Publish command, you can take advantage of the default Publish settings of Director, or you can modify them with the Publish Settings dialog box. For the tutorial movie, you’ll publish the movie using the Detect Shockwave HTML page which, in addition to including OBJECT and EMBED tags that are necessary to display your movie correctly in a browser, includes JavaScript that detects if your user has the correct version of Shockwave.
Continue learning about Director By completing this tutorial, you’ve become familiar with the basic tasks and procedures used to create Director movies.
CHAPTER 3 Director MX 3D Tutorial Macromedia Director MX includes three-dimensional (3D) images, text, and animations with the suite of Macromedia design and development tools. 3D cast members in your Director movies allow realistic spatial rendering of graphical objects. With Director MX 3D features, you can create and view images that have depth as well as height and width. What you’ll learn This tutorial introduces you to the use of 3D in Director MX.
View the completed movie You can view a completed version of the tutorial movie to become familiar with how your finished movie will appear. 1 Launch Director, and then select File > Open. 2 Browse to the Director MX application folder and open Tutorials/3D/Magic_finished.dir. 3 To play the movie, click the Play button, along the bottom of the Stage window, or select Control > Play. A subtle light appears to shine on the text as it rotates.
1 If the Stage and Library are not open, select Window > Library Palette. 2 If your Internal Cast window is not open, select Window > Cast. In the Cast window, find the cast member named Title text. Title text is 2D text created in Director MX. 3 In the Score (Window > Score), select frame 1 in channel 3. 4 Drag the Title text cast member from the Internal Cast window to the upper left area of the Stage, as shown in the following illustration.
6 If the Property inspector Sprite tab is not visible, click the Title text sprite on the Stage. On the Sprite tab, type 0 in the X text box and 0 in the Y text box. Press Enter (Windows) or Return (Macintosh). You use the X and Y text boxes to place the sprite precisely. 7 Type 70 in the End frame text box and press Enter (Windows) or Return (Macintosh) to extend the Title text sprite to the end of the movie.
9 In the Display pop-up menu, select 3D Mode. On the Stage, the text becomes 3D. Modify the 3D text You can alter the appearance of the 3D text by changing settings in the Property inspector 3D Extruder tab. 1 Click the Property inspector 3D Extruder tab. 2 Move the Tunnel Depth slider left and right to see the different effects. When you release the mouse button, the depth of the text changes. 3 When you finish experimenting with the different tunnel depths, move the slider to a value close to 20.
4 In the Light pop-up menu, select Top Center. Three-dimensional objects in Director can use both ambient and directional lights. By specifying Top Center as the light, you’re indicating where on the text it should appear as though a light is shining. The Title text sprite changes to reflect the settings in the Property inspector.
Rotate the 3D text To rotate the text, you use a behavior from the Library palette. When the 3D text rotates, the directional light that you specified in the Property inspector appears to shine on one fixed position, lighting the text much as a spotlight would. 1 In the Library List pop-up menu, if Actions is not already selected, select 3D > Actions. The Library includes two types of 3D behaviors: actions and triggers. Actions specify what occurs in the movie, such as a camera rotating around a model.
5 In the Which Axis to Rotate About pop-up menu, select Y, and then click OK. The x- and y-axes are the model’s horizontal and vertical axes, respectively; the z-axis refers to the depth of the model. 6 To view the 3D text rotating, play your movie. The rotation speed seems a bit fast. To avoid making your users dizzy, you’ll modify the behavior parameters. 7 Stop and rewind the movie. Note: As you complete the tutorial, remember to save your work frequently.
Modify behaviors Once you’ve added a behavior to a sprite, you can use the Property inspector to modify the behavior. Slow the rotation speed To slow the rotation speed setting, complete the following steps: 1 With the Title text sprite selected, click the Property inspector Behavior tab. 2 With Automatic Model Rotation (Internal) selected in the Property inspector, click the down arrow to the right of Rotation Speed and move the Rotation Speed slider from 10 to 3.
View a 3D world Click the magic shop scene on the Stage. The scene is comprised of models within a single sprite named Magic trick. The Magic trick cast member is an example of a 3D world. The 3D world contains models, which are the visible objects within the world, such as the tables. Your view of a world depends on the position of the camera. Magic trick sprite Use the camera The camera is the lens through which you view the world.
3 In the Parameters for Pan Camera Horizontal dialog box, specify the following: • In the Degrees to Pan Per Frame text box, type 10. • In the Which Group Does This Behavior Belong To text box, type Pan. Then click OK. You are creating a group, named Pan, to which you’ll add actions and triggers. An action and its trigger must be in the same group to work together. You are, in effect, grouping actions with their associated triggers.
Specify the panning trigger for the opposite direction Naturally, you want to give your user the ability to pan the camera to the right as well as to the left. The procedure to add a keyboard input to pan left is similar to the keyboard input procedure you just completed. 1 You’ve already used the Keyboard Input behavior once, making it part of your cast. Drag the Keyboard Input behavior from the Cast window to the Magic trick sprite on the Stage.
Pan the camera horizontally To see the Pan Camera Horizontal behavior in action, do the following: 1 Play the movie and press the Left Arrow key repeatedly. Each time you press the key, the camera for the 3D world moves a little to the left. 2 Press the Right Arrow key to see the camera change direction. 3 When you finish viewing the panning behaviors, stop and rewind the movie.
Add a trigger for the Pan Camera Vertical action Again, you must associate triggers with the action. First, you will specify a trigger to pan the camera upward. 1 Drag the Keyboard Input behavior from the Cast window to the Magic trick sprite on the Stage. 2 In the Parameters for Keyboard Input dialog box, specify the following: • In the Which Key Will Be Used pop-up menu, select Up Arrow. • Verify that the second text box is blank and that No Modifier Key appears in the third text box.
Pan the camera vertically Now you’ll test the pan behaviors that you added. 1 Play the movie. 2 Press the Up Arrow key to see the camera tilt up, and press the Down Arrow key to see the camera tilt down. 3 When you finish moving the camera, stop and rewind the movie. Add the Dolly Camera behavior Another way to manipulate the view of a 3D world during movie playback is to dolly the camera.
Add the triggers for the Dolly Camera behavior You have already associated triggers with all four of the arrow keys. You’ll now specify that the F and B keys trigger the forward and backward dollying action. 1 Drag the Keyboard Input behavior from the Cast window to the Magic trick sprite either on the Stage or in the Score.
4 In the Parameters for Keyboard Input dialog box, specify the following: • In the Which Key Will Be Used pop-up menu, verify that The Custom Key I’ve Entered Below is selected. • In the If Using a Custom Key, Enter It Here text box, type b. • Verify that No Modifier Key is selected from the Which Modifier Key Will Be Used pop-up menu. • In the Select a Group and Its Action pop-up menu, select Dolly – Move Camera Out. Then click OK. Note: Remember to save your work frequently.
Reset the camera Once the camera starts moving around the world, it can be tricky for the user to return to the original camera position—unless you’ve included a way to reset the camera. Fortunately, Director MX has a Reset Camera behavior, which you’ll now apply. 1 In the Library palette, verify that 3D > Actions is selected. Drag the Reset Camera behavior to the Magic trick sprite.
Set model rollover cursors Often in interactive movies, the pointer transforms into a hand when it’s over an object the user can click, such as a link or hot spot. The Model Rollover Cursor behavior lets you select a model, then specify how the pointer will appear when it’s over that model. A model can consist of a single object, or multiple objects collected together as one model.
7 When you finish viewing this behavior, stop and rewind the movie. The cursor changes to a pointing finger Use 3D behaviors for navigation When a pointer changes to a pointing finger, users know that they can click and expect some sort of result. In your movie, a click of the pointing finger displays information about the merchandise on the tables. If you look in your Score, you see that the text associated with the merchandise first appears in frame 10 of channel 1.
Use the Click Model Go to Marker behavior The Click Model Go to Marker behavior lets you specify both the model in a 3D world that the user clicks and the marker that the playhead moves to when the user clicks the model. 1 In the Library, with 3D > Actions selected, drag the Click Model Go to Marker behavior from the Library palette to the Magic trick sprite. 2 In the Parameters for Click Model Go to Marker dialog box, specify the following: • In the Which Model pop-up menu, select Table 1.
Select the action and trigger for the Hat marker You’ll repeat the procedure to add the Click Model Go to Marker action behavior and trigger behavior for the middle table. 1 Drag the Click Model Go to Marker behavior from the Cast window to the Magic trick sprite. 2 In the Parameters for Click Model Go to Marker dialog box, specify the following: • In the Which Model pop-up menu, select Table 2. • In the Go to Which Marker pop-up menu, select Hat.
You’ve almost finished By now, you should be familiar with the procedure to add the Click Model Go to Marker action and its trigger. You’ll repeat the steps a final time for the remaining table. 1 Drag the Click Model Go to Marker behavior from the Cast window to the Magic trick sprite. This time, specify Table 3 in the Which Model pop-up menu and Rings in the Go to Which Marker pop-up menu. Create a new group named Rings. Then click OK.
3 Use the left mouse button (Windows) to click on the Table 1 model. (Macintosh users with a single-button mouse can simply click.) Notice the following: • The movie plays from frame 10, the frame labeled with the Cards marker, to frame 20. By clicking Table 1 during playback mode, you cause the action to jump to another marker on the Score. • The merchandise and pricing information that appears above the 3D world comes from the text sprite in frames 10 to 20.
CHAPTER 4 Cast Members and Cast Windows Cast members are the media and other assets in your movie. They can be bitmaps, vector shapes, text, scripts, sounds, Macromedia Flash movies, QuickTime movies, AVI videos, and more. When you place a cast member on the Stage or in the Score, you create a sprite. For more information on sprites, see Chapter 5, “Sprites,” on page 157. You use windows called casts to group and organize your cast members. To populate casts, you import and create cast members.
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 automatically created, 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 132.
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 134.) Cast button 2 In the New Cast dialog box, type a name for the new cast. 3 Specify how to store the cast: stores the cast within the movie file.
Creating cast members You can create several types of cast members in Director. Director includes editors to create and edit common media such as text, shapes, and bitmaps. You can also define external editors to launch from within Director when you double-click a cast member, and edit almost any type of supported media. See “Launching external editors” on page 151. You can also import cast members. See “Importing cast members” on page 146.
To create a cast member in a media editing window: 1 Open a media editing window by selecting Window and then selecting the type of cast member you want to create (Paint, Vector Shape, Text, and so on). 2 Click the New Cast Member button to create a cast member of the corresponding type. The cast member is added to the most recently active Cast window. New Cast Member button To create a cast member using the Script window: 1 Open the Script window by selecting Window > Script.
Switching from one Cast window view to another You can easily toggle between List and Thumbnail views of the Cast window. To switch from one Cast window view to another, do one of the following: • Click the Cast View Style button on the Cast window to toggle between the two views. Cast View Style • With the Cast window active, select View > Cast, and select either List or Thumbnail, as desired.
To group a Cast panel with another Cast panel or Cast panel group: 1 Select a Cast panel or a tab within a Cast panel group. 2 From the panel’s Options menu, select Group [Panel Name] With, then select a panel or panel group name from the submenu that appears. To remove a panel (tab) from a Cast panel group: 1 Select a tab within a Cast panel group. 2 From the panel group’s Options menu, select Group [Panel Name] With, then select New Panel Group from the submenu that appears.
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.
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. See “Viewing and setting cast member properties” on page 142. To view the cast member number: • Refer to the Cast Member Number field in the upper right corner of the Cast window.
Naming cast members To avoid problems in Lingo when referring to cast members, you should name them and 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 uses the cast member with the lowest number in the cast. To name a cast member: 1 Select the cast member in either the List or the Thumbnail view of the Cast window.
Column Title Column Information Modified By Who modified the cast member. This value comes from the user login name (Windows) or the Sharing setup name (Macintosh). Filename The full path to the cast member if it is a linked asset Resizing columns in Cast List view You can resize columns in Cast List view. To resize a column: 1 Hold the pointer over the column boundary to activate the Resizing tool. 2 Drag the column to the desired size.
Icon Cast member type Icon Cast member type Movie script OLE Palette Parent script PICT QuickTime video Radio button RealMedia Shape Shockwave 3D Shockwave Audio Sound Text Transition Vector shape Xtra To turn off or on the display of cast member icons in Thumbnail view and change the Cast window display: • Select Edit > Preferences > Cast. See “Setting Cast window preferences” on page 140.
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 scripts.
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 Size arranges the selection with the largest files appearing first.
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 136. 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.
12 To make your preference settings the default settings, click Save as Default. 13 When you finish selecting your preferences, click OK. 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.
To view and set cast member properties: 1 Select one or more cast members. 2 Do one of the following: • If the Property inspector is open, click the Member tab. • If the Property inspector is not open, select Window > Property Inspector, and click the Member tab. As with all fields in the Property inspector, if you’ve selected multiple cast members, the information that is common to all the selected cast members appears. Any changes you make apply to all the selected cast members.
For information on specific cast member properties, see the following topics: • • • • • • • • • • • • • • • • “Using animated GIFs” on page 205” “Embedding fonts in movies” on page 274 “Using Flash Movies” on page 293 “Setting bitmap cast member properties” on page 237 “Setting vector shape properties” on page 252 “Synchronizing media” on page 328 “Setting film loop properties” on page 198 “Setting palette cast member properties” on page 266 “Setting PICT cast member properties” on page 238 “To specify a
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.
To find a cast member in the Score: 1 Select a cast member for which to search in the cast or the Score. If you select a sprite that includes multiple cast members, Director searches for the first cast member in the sprite; to select a cast member other than the first, open the sprite to select the cast member. (For information on selecting sprites, see “Selecting sprites” on page 158.) 2 Select Edit > Find > Selection, or press Control-H (Windows) or Command-H (Macintosh).
2 Select File > Import. 3 To import a file from the Internet, click Internet and enter a URL in the Find URL text box. 4 To import local files, select the type of media to import from the Files of Type (Windows) or the Show (Macintosh) pop-up menu. All the files in the current directory appear unless you make a selection. 5 To select a file or files to import, do one of the following: • Double-click a file. • Select one or more files, and click Add. • Click Add All.
Link to External File creates a link to the selected files and imports the data each time the movie runs. If you choose to import from a URL via the Internet, the media is dynamically updated. For more information, see “About linking to files” on page 149. Note: Text and RTF files are always imported and stored inside the movie file (see the previous option, Standard Import), even if you select Link to External File.
About import file formats Director can import files in all the formats listed in the following table. For information on additional file formats Director might support, see the Director Support Center website at www.macromedia.com/support/director. Type of file Supported formats Animation and multimedia Flash movies, animated GIF, PowerPoint presentations, Director movies, Director external cast files Image BMP, GIF, JPEG, LRG (xRes), Photoshop 3.
Choosing import image options If you import a bitmap cast member with a color depth or color palette that is different from that of the Stage (the current movie), Director lets you select the image’s color depth and color palette. You can choose to import the bitmap at its original color depth or at the Stage color depth. (The Stage color depth is the same as the system color depth.) You can also choose to import the image’s color palette or remap the image’s colors to a palette in the movie.
2 If the PICS/Scrapbook Options dialog box appears while you are importing an image using File > Import, specify the range of images to import: imports as many as 512 frames in a PICS file or from a Scrapbook file. Each frame is imported as a separate cast member. All Frames selects a range of cells. The imported PICS or Scrapbook frames are added to the Score beginning at the selected cell; any existing Score data is replaced by the imported frames.
To launch an external editor: 1 Select a cast member of a media type for which you have defined an external editor, and do one of the following: • If you specified Use External Editor when you defined the external editor for this media type, double-click the cast member. • Select Edit > Launch External Editor. • While the cast member is selected and the Cast window is active, right-click (Windows) or Control-click (Macintosh) and select Launch External Editor from the context menu.
Managing external casts An external cast is a separate file that must be explicitly linked to a movie for the movie to use its cast members. If you link an external cast to a movie, Director opens the cast every time it opens the movie. If you don’t link an external cast to a movie, you must open and save the file separately. You can use unlinked external casts as libraries to store commonly used elements for authoring, such as scripts, buttons, and so on. See “Creating libraries” on page 154.
Creating libraries A library is a special type of unlinked external cast that appears in the Library palette. When you drag a cast member from an external cast library to the Stage or Score, Director automatically copies the cast member to one of the movie’s internal casts. Libraries are useful for storing any type of commonly used cast members, especially behaviors. A library cannot be linked to a movie. See “Attaching behaviors” on page 357.
Setting Xtra cast member properties Xtra cast members have the same Name and Unload properties as other cast members, but they can also contain an extra panel of options that is accessible from the Property inspector. To set cast member properties, use the Member tab and the custom tab for the type of cast member you are working with. The Member tab contains an Edit button and might contain a More Options button, depending on the type of Xtra.
Chapter 4
CHAPTER 5 Sprites A sprite is an object that controls when, where, and how cast members appear in a Macromedia Director MX movie. Multiple sprites can use the same cast member. You can also switch the cast member 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 display on the Stage layered according to the channel in which they’re in the Score.
Changing sprite preferences You use the Sprite Preferences dialog box to control the way sprites behave and appear in the Score window and on the Stage. To change preferences for sprites: 1 Select Edit > Preferences > Sprite. 2 To determine if selecting a sprite on the Stage selects the entire span of the sprite or only the current frame in the sprite, select one of the following Stage Selection options: Entire Sprite selects the sprite in all frames that it occupies.
A selected sprite appears on the Stage with a double border. When you select a single frame within a sprite, the sprite appears on the Stage with a single border. Entire sprite selected Single frame within sprite selected To select sprites, do one of the following: Note: The following techniques select an entire sprite only if Edit Sprite Frames is not enabled for the sprite(s) you select. • On the Stage, click a sprite to select the entire sprite span.
• 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. • To select a keyframe and sprites at the same time, Control-click (Windows) or Command-click (Macintosh) the keyframe and the desired sprites.
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 on the Stage: 1 Select the sprite. To select the contents of an entire channel, click the channel number at the left side of the Score.
Displaying and editing sprite properties in the Property inspector Depending on your preference, you can use either the Sprite toolbar or the Property inspector to perform many of the same procedures. To display and edit sprite properties in the Property inspector: 1 Select one or more sprites on either the Stage or the Score. 2 If the Property inspector is not open, select Window > Property Inspector. The Property inspector opens with focus on the Sprite tab. The Graphical view is the default view.
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 cannot change it. For additional information on locked sprites, see “Locking and unlocking sprites” on page 167. applies only to text sprites and lets you edit the selected text sprite on the Stage during playback. See “Selecting and editing text on the Stage” on page 277. Editable Moveable lets you position the selected sprite on the Stage during playback.
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 display the Sprite Overlay when a sprite is selected: • Select View > Sprite Overlay > Show Info.
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. For example, if you detect a strange blip caused by an ink effect, you can turn on Ink display and quickly locate the problem in a sprite label.
To change sprite label options: • Select a display option from the Display pop-up menu in the Score or from the View > Display menu. Cast Member displays the name and number of the sprite’s cast member. 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.
Locking and unlocking sprites During authoring, you can lock sprites to avoid inadvertent changes to the sprite, either by you or by someone else working on the same project. When you lock a sprite, you can no longer change its settings, although you still see it represented on the Stage and in the Score. While preserving the settings of your locked sprites, you can continue to create and edit unlocked sprites. Locking sprites is not supported during playback.
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.
To visually position a sprite on the Stage during playback: 1 Select a sprite that you want to position during playback. 2 On the Sprite tab in the Property inspector, click Moveable. See “Displaying and editing sprite properties in the Property inspector” on page 162. 3 Begin playing back the movie. 4 On the Stage, drag the sprite to the new position. Positioning sprites with the Property inspector You can use the Property inspector to specify the exact coordinates of a sprite.
You can create and modify the guides and the grid from the Property inspector or by using menu commands. To add and configure guides: 1 With the Property inspector open, click the Guides tab. The top half of the tab contains settings for Guides. 2 To change the guide color, click the Guide Color box and select a different color. 3 Select the desired options to make the guides visible, to lock them, and to make the sprites snap to the guides.
To configure the grid: 1 With the Property inspector open, click the Guides tab. The bottom half of the Guides tab contains Grid settings. 2 To change the grid color, click the Grid Color box and select a different color. 3 Select the desired options to make the grid visible and to make the sprites snap to the grid. 4 To change the width and height of the grid, enter values in the W and H text boxes. 5 Select the desired options to display the grid as dots or lines.
To place a sprite at a specific location: • Set one of the following properties (see the Lingo Dictionary for entries on each property): The loc sprite property sets the horizontal and vertical distance from the upper left corner of the Stage to the sprite’s registration point. The value is given as a point. sets the number of pixels from the top of the Stage to a sprite’s The locV sprite property registration point.
To copy or move sprites between frames: 1 Select a sprite or sprites, as described in “Selecting sprites” on page 158. 2 Select Edit > Cut Sprites or Edit > Copy Sprites. 3 Position the pointer where you want to paste the sprite, and select Edit > Paste Sprites. If the pasting will overwrite existing sprites, select one of the following Paste options in the Paste Options dialog box: Overwrite Existing Sprites replaces the sprites with the content of the Clipboard.
To extend a sprite to the current location of the playhead: 1 Select the sprite or sprites to extend. 2 Click the frame channel to move the playhead: • To extend the sprite, move the playhead past the right edge of the sprite. Frame channel • To shorten the sprite, move the playhead to the left of the sprite’s right edge, inside the sprite. • To move the sprite’s start frame, place the playhead to the left of the sprite. 3 Select Modify > Extend Sprite.
Changing the appearance of sprites You can change the appearance of sprites on the Stage without affecting the cast member assigned to the sprite. You can resize, rotate, skew, flip, and apply new foreground and background colors to sprites. Applying these changes allows you to reuse the same cast member to create several different versions of an image. For example, you can create a flipped and rotated sprite with a new color.
To restore a sprite to its original dimensions, do one of the following: • On the Sprite tab in the Property inspector (Graphical view), click Restore All. • Select Modify > Transform > Reset Width and Height or Reset All. To resize a sprite’s bounding rectangle with Lingo: • Set the sprite’s quad or rect sprite property. See quad or rect (sprite) in the Lingo Dictionary. The rect sprite property determines the coordinates of a sprite’s bounding rectangle.
To rotate or skew a sprite on the Stage: 1 Select a sprite on the Stage. 2 Select Window > Tool Palette to display the Tool palette. 3 Click the Rotate tool in the Tool palette. You can also press Tab while the Stage window is active to select the Rotate tool. The handles around the sprite change to indicate the new mode. 4 Do either of the following: • To rotate the sprite, move the pointer inside the sprite and drag in the direction you want to rotate.
3 To skew the selected sprite, enter the number of degrees in the Skew text box. Rotate Skew To resize a rotated or skewed sprite, do one of the following: • Click the Rotate or Skew tool and drag any of the sprite’s handles. Use Alt-drag (Windows) or Option-drag (Macintosh) to maintain the sprite’s proportions as you resize. • Enter new values on the Sprite tab in the Property inspector. Director resizes the sprite at the current skew or rotation angle.
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. • Select Modify > Transform > Flip Horizontal in Place or Flip Vertical in Place to flip the sprite so that its bounding rectangle stays in place and the registration point is moved, if necessary.
Setting blends You can use blending to make sprites transparent. To change a sprite’s blend setting, use the Sprite tab in the Property inspector. Blend setting of 30% Blend setting of 100% Director can gradually change blend settings to make sprites fade in or out. See “Tweening other sprite properties” on page 188. The Blend percentage value affects only Copy, Background Transparent, Matte, Mask, and Blend inks. To set blending for a sprite: 1 Select the sprite.
You change the ink for a sprite in the Property inspector or with Lingo. Sprite with Copy ink Sprite with Matte ink To achieve the fastest animation rendering on the screen, use Copy ink; other ink types might have a slight effect on performance. To change a sprite’s ink with the Property inspector: 1 Select the sprite. 2 Select the desired type of ink from the Ink pop-up menu on the Sprite tab in the Property inspector. To change a sprite’s ink with Lingo: • Set the sprite’s ink sprite property.
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. Director ignores the palette of mask cast members that are less than 32-bit images; using a grayscale palette lets you view the mask in a meaningful way. If your mask cast member is a 32-bit image, the colors of the mask tint the sprite’s colors.
Ink definitions The following definitions describe all available ink types. 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 do not 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.
CHAPTER 6 Animation Animation is the appearance of an image changing over time. The most common types of animation in Macromedia Director MX 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.
About tweening in Director To use tweening in Director, you define properties for a sprite in frames called keyframes and let Director change the properties in the frames in between. Tweening is very efficient for adding animation to movies for websites, since no additional data needs to download when a single cast member changes. 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.
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 will follow. The tick marks along the path show the sprite location in each frame in between.
Accelerating and decelerating sprites To create more natural motion in tweened sprites, use the following settings in the Sprite Tweening dialog box: • Ease-In and Ease-Out control how a sprite moves from its start frame to its end frame, no matter how many keyframes are in between. Ease-In makes a sprite move more slowly in the beginning frames; Ease-Out makes the sprite slow down in the ending frames. This setting makes the sprite move more like an object in the real world.
To tween sprite properties: 1 If the Score isn’t open, select Window > Score. 2 Position a sprite on the Stage and make sure it spans all the frames in which you want the sprite to change. 3 Select the start frame of the sprite in the Score. 4 To tween size, scale the sprite or resize the sprite on the Stage. See “Resizing and scaling sprites” on page 175.
Suggestions and shortcuts for tweening Follow the suggestions listed here to improve results and productivity while tweening sprites. • For smoother movements, tween across more frames, increasing the tempo if necessary. • To achieve some types of motion, you may need to split the sprite and tween the sprites separately. See “Accelerating and decelerating sprites” on page 188. • To quickly make duplicates, Alt-drag (Windows) or Option-drag (Macintosh) keyframes.
4 To change how the sprite curves between positions defined by keyframes, adjust the Curvature slider. Linear makes the sprite move in a straight line between the keyframe positions. Normal makes the sprite follow a curved path inside the keyframe positions. Extreme makes the sprite follow a curved path outside the keyframe positions. 5 To make the sprite move smoothly through start and end frames when it moves in a closed path, select Continuous at Endpoints.
If you selected an entire sprite, Director replaces the cast member for the entire sprite. Before cast members are exchanged, the sprite moves like this. After cast members are exchanged, the sprite still moves in the same way, but it displays a different cast member. You can also use Lingo to switch the cast member assigned to a sprite. See “Assigning a cast member to a sprite with Lingo” on page 184.
Frame-by-frame animation To create animation that is more complex than is possible with simple tweening, you can use a series of cast members in frame-by-frame animation. Sprites usually refer to only one cast member, but they can refer to different cast members at different times during the life of the sprite. For example, an animation of a man walking may display several cast members showing the man in different positions.
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. Drag the start or end frame in the Score, or enter a new start or end frame number in the Sprite Inspector. 3 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 165.
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), 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’ve deleted the original Score data it was based on, it’s possible to restore the Score data for editing. Copy the film loop cast member to the Clipboard, select a cell in the Score, and then paste.
9 To determine how the film loop plays back, use the following settings: Audio plays the sound portion of the film loop. Turn this option off to mute sounds. replays the film loop continuously from the beginning to the end and back to the beginning. Loop Step-recording animation Step recording is a process of animating one frame at time.
Real-time recording animation You can create animation by recording the movement of a sprite as you drag it across the Stage. The real-time recording technique is especially useful for simulating the movement of a pointer or for quickly creating a complex motion for later refinement. For better control when you’re recording in real time, use the Tempo control in the Control panel to record at a speed that’s slower than normal.
Linking a sequence with Paste Relative Paste Relative automatically aligns the start frame of one sprite with the end frame of the preceding sprite. It’s useful for extending animations across the Stage. The first sprite ends here, and the pasted sprite begins. To paste one sequence relative to another: 1 Select a sprite in the Score 2 Select Edit > Copy Sprites. 3 Select the cell immediately after the last cell in the sprite. 4 Select Edit > Paste Special > Relative.
Chapter 6
CHAPTER 7 Bitmaps Bitmaps and vector shapes are the two main types of graphics used with Macromedia Director MX. 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 239. For more information about vector shapes, see Chapter 8, “Vector Shapes,” on page 245.
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 change the location of the registration point, do one of the following: • Click the Registration Point tool, and click the spot where you want to set the registration point. • Double-click the Registration Point tool to set the registration point in the center of the image. See “Changing registration points” on page 219. 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 draw a 1-pixel line in the current foreground: • Click the Pencil tool, and drag it in the Paint window. To constrain the line to horizontal or vertical, Shift-Click and drag. If the foreground color is the same as the color underneath the pointer, the Pencil tool draws with the background color. To spray variable dots of the foreground color: • Click the Airbrush tool, and drag it in the Paint window.
To select a foreground and destination color for color-shifting inks: • Click the color box on the left to select a foreground color; click the color box on the right to select a destination color. These colors affect the Gradient, Cycle, and Switch inks. Each of these inks uses a range of colors that shifts between the foreground color and the destination color. See “Using gradients” on page 224 and “Using Paint window inks” on page 229.
To select a line thickness, do one of the following: • Click the None, One-, Two-, or Three-Pixel Line button. Other line width • Double-click the Other Line Width button to open the Paint Window Preferences dialog box, and assign a width to the line. To change the color depth of the current cast member: • Double-click the Color Depth button to open the Transform Bitmap dialog box. Color Depth The button displays the color depth of the current cast member.
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 make a copy of artwork that is selected with the Marquee tool: • Hold down Alt (Windows) or Option (Macintosh) while dragging the selection. 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. No Shrink lets you select everything within the marquee.
Using the Brush tool You use the Brush tool to brush strokes with the current color, ink, and fill pattern. To select a different size and brush shape, you use the Brush Settings dialog box. The selections you make in the Brush Settings dialog box are assigned to the menu item in the pop-up menu and remain in effect until you change them. Each of the five settings in the pop-up menu can be defined so you can have several types of spray available without opening the Brush Settings dialog box.
Zooming in and out in the Paint 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 zoom in or out, do one of the following: • Click the Magnify tool, and click the image. Click again to increase the magnification. Shiftclick to zoom out. • Select Zoom In or Zoom Out from the Paint window’s Options menu. • Select View > Zoom, and select the level of magnification.
• To copy and stretch the selection (Marquee tool only), Control-Alt-drag (Windows) or Command-Option-drag (Macintosh) the selection. • To constrain the movement of the selection to horizontal or vertical, Shift-drag the selection. • To move the selection one pixel at a time, use the arrow keys. Flipping, rotating, and applying effects to bitmaps The toolbar at the top of the Paint window contains buttons to apply effects to bitmaps.
• To rotate the selection by any amount in either direction, click the Free Rotate button, and drag the rotate handles in any direction. (You can rotate a sprite that contains a bitmap instead of the bitmap. See “Rotating and skewing sprites” on page 176.) • To skew the selection, click the Skew button, and drag any of the skew handles. • To warp the shape of the selected area, click the Warp button, and drag any handle in any direction.
• To create a perspective effect, click the Perspective button, and drag one or more handles to create the effect you want. • To create an outline around the edges of the selected artwork, click the Trace Edges button. To apply color effects to a selected area: 1 Select an area within a bitmap cast member 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.
• 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. This effect works on 8-bit (256 color) images only. • To fill the selected area with the current foreground color and pattern, click the Fill button. • To change all pixels of the foreground color within the selection to the currently selected destination color, click the Switch Colors button.
4 In the Auto Distort dialog box, enter the number of cast members to create and click the Begin button. Director generates new cast members with an intermediate amount of change applied to each one. The new cast members appear in the first available cast positions. Changing registration points A registration point is a marker that appears on a sprite when you select it with your mouse. (Registration points do not appear on unselected sprites or when a movie is playing.
To set a registration point: 1 Display the cast member you want to change in the Paint window. 2 Click the Registration Point tool. The dotted lines in the Paint window intersect at the registration point. The default registration point is the center of the cast member. The pointer changes to a cross hair when you move it to the Paint window. 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.
4 To change the color depth, select an option from the Color Depth pop-up menu. For more information about the color depth of bitmap cast members, see “Controlling color” on page 255. 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.
Controlling bitmap images with Lingo Lingo lets you control bitmap images in two ways. First, you can perform simple operations that affect the content of entire image cast members. These operations include changing the background and foreground colors as well as switching the image that appears in a specific cast member with that of another cast member. Each of these operations manipulates a property of the entire image cast member.
Editing image objects After you create an image object, its data can be edited with a variety of Lingo commands that are designed to manipulate the pixels of the image. You can crop images, draw new pixels on them, copy sections of them, and work with mask and alpha channel information. For more information, see the individual commands in the Lingo Dictionary. To draw a line on an image object: • Use the draw() command. You must specify the locations of each end of the line as well as the line’s color.
To make a new image object from the alpha channel information of a 32-bit image object: • Use the extractAlpha() command, which can be useful for preserving the alpha channel information of a 32-bit image object that you plan to reduce to a lower bit depth. Reducing the bit depth can delete the alpha information. The following statement creates a new image object called alphaImage from the alpha channel information of the 32-bit image object called myImage: alphaImage = myImage.
5 Use the current tool in the Paint window. Director uses the gradient you’ve defined to fill the image. 6 To stop using a gradient, select Normal from the Ink pop-up menu. See “Using Paint window inks” on page 229. Editing gradients You can change gradients before using them by changing the settings in the Gradient Settings dialog box. In the Gradient Settings dialog box, you set the foreground and background colors as well as the pattern to use with your gradient.
3 To determine how a gradient shifts between colors, select an option from the Method pop-up menu: If you select Dither as the Type option, the following choices are available: ignores the order of the colors in the palette. Instead, it uses only colors that create a continuous blend from foreground to background colors and blends them with a dithered pattern. Dithering is a technique that creates color from two or more colors of pixels interspersed together.
5 To control how colors cycle in a gradient, select a Cycles option, as described in the following list: Sharp cycles have a banded appearance; smooth cycles go from foreground to destination and then back to foreground. One cycles the gradient once through the range of colors you define. Two Sharp cycles through the range of colors from foreground to destination twice. cycles the gradient from foreground to destination and then from destination to foreground.
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 do not 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. See “Editing patterns” on page 228.
Creating a custom tile Custom tiles provide an effective way of filling a large area with interesting content without using much memory or increasing the downloading time. They are especially useful for large movies on the web. A custom tile uses the same amount of memory no matter what size area it fills. To create a custom tile: 1 Create a bitmap cast member to use as a tile, and display it in the Paint window.
The result of the ink you select depends on whether you are working in color or in black and white. Also, some inks work better when painting with patterns, and others work better when painting with solid colors.
Cycle is a color ink. As you draw with Cycle ink, the colors change as the ink progresses through the palette. The beginning and ending points of the color cycle are determined by the foreground and destination colors. If you want to cycle through the whole palette, select white as the foreground color and black as the destination color. This ink works only when your computer is set to 256 colors.
Using bitmap filters Bitmap filters are plug-in image editors that apply effects to bitmap images. You can install Photoshop-compatible filters to change images within Director. Original image Filtered image You can apply a filter to a selected portion of a bitmap image, to an entire cast member, or to several cast members at once. To install a filter: • Place the filter in the Xtras folder in the Director application folder. See “About installing Xtra extensions” on page 51.
Using filters to create animated effects You can use Auto Filter to create dramatic animated effects with bitmap filters. Auto Filter applies a filter incrementally to a series of cast members. You can use it either to change a range of selected cast members or to generate a series of new filtered cast members based on a single image. When you define a beginning and ending setting for the filter, Auto Filter applies an intermediate filter value to each cast member.
Using onion skinning Onion skinning derives its name from a technique used by conventional animators, who would draw on thin “onion skin” paper so that they could see through it to one or more of the previous images in the animation. With onion skinning in Director, you can create or edit animated sequences of cast members in the Paint window using other cast members as a reference. Reference images appear dimmed in the background.
• To specify the number of following cast members to display, enter a number in the Following Cast Members text box. Registration point Two preceding cast members shown with onion skinning and registration points The specified number of cast members appear as dimmed images behind the current cast member. The order is determined by the position in the cast. To create a new cast member by tracing over a single cast member as a background image: 1 Open the Paint window, and select View > Onion Skin.
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 Graphical view.
Setting PICT cast member properties You use PICT cast member properties to change the names of PICT cast members and set their properties. To view or change PICT cast member properties: 1 Select a PICT cast member, and open the Property inspector in Graphical view. 2 To view or edit the cast member name, use the Name field text box on the Member tab. 3 To specify how Director removes the cast member from memory if memory is low, select an option from the Unload pop-up menu.
7 To determine how colors are used when using Smooth, Lighten, Darken, or Cycle effects, select one of the following Interpolate By options: ignores the order of the colors in the palette and produces a continuous blend of the foreground and destination colors. Color Value Palette Location uses all the colors in the palette between the foreground and destination colors.
Similarly, the Compression setting defaults to Standard compression, and you cannot change this setting when the cast member is any of the following: • • • • An 8-bit cast member created in the Paint window A GIF imported as a bitmap with no alpha channel information An 8-bit PNG A linked cast member or a cast member created with Lingo Note: If you open a Director 7 movie in Director MX, bitmap cast members are assigned Movie Setting as the default, and compression settings at the movie level, set in the
Exporting layered and sliced content to Director By exporting Fireworks slices to Director, you can export sliced and interactive content such as buttons and rollover images. By exporting layers to Director, you can export layered Fireworks content such as animations. To export Fireworks files to Director: 1 In Fireworks, select File > Export. Note: You can also click the Quick Export button and select Source as Layers or Source as Slices from the Director pop-up menu.
To import layered, sliced, or interactive Fireworks content: 1 In Director, select Insert > Fireworks > Images from Fireworks HTML. Note: The location and name of this menu command might be different depending on your version of Director. 2 Locate the Fireworks HTML file you exported for use in Director. The Open Fireworks HTML dialog box appears. 3 Change the following options if desired: lets you specify a color depth for the imported graphics.
Editing Director cast members in Fireworks Using launch-and-edit integration, you can make changes to Director cast members by launching Fireworks to edit them from inside Director. You can also launch Fireworks from inside Director to optimize cast members. To launch Fireworks to 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 7
CHAPTER 8 Vector Shapes Vector shapes and bitmaps are the two main types of graphics used with Macromedia Director MX. 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 you define. • To constrain a new point to vertical, horizontal, or a 45° angle, hold down Shift while clicking.
To create multiple curves, do one of the following: • If you use the Pen tool, double-click the last vertex drawn. The next vertex will start a new curve. • With no vertices selected, use the Pen tool to start a new curve. • To create two separate curves from one, select two adjacent vertices in a curve and select Modify > Split Curve. • If the current shape is empty or closed, select one of the shape tools and draw a new shape.
• To set the background color, select a color from the Background Color menu. Choosing a background color that matches the color of the background results in better performance than using Background Transparent ink. • To set gradient fill colors, select colors from the Gradient Colors control. For more information about creating gradient fill, see “Editing vector shapes” on page 249. • To set the fill type, select from the following Fill type control options: No Fill, Solid, or Gradient.
• To move the window view without using the scroll bars, click the Hand tool and drag anywhere inside the shape. To add a point in the middle of a shape: 1 Open a vector shape in the Vector Shape window. 2 Click the Pen tool. 3 If the shape is closed, move the pointer over a line until it changes and then click the mouse button. If the shape is open, hold down Alt (Windows) or Option (Macintosh) and move the pointer over a line until it changes; then click the mouse button.
To close or open vector shapes: • Select or deselect the Close box at the left side of the window. If the shape is closed, Director draws a line between the last and first points defined; if it is open, Director removes the line between the last and first points. To close a shape with Lingo: • Set the closed cast member property to true. See closed in the Lingo Dictionary. To scale a vector shape: • Control-Alt-drag (Windows) or Command-Option-drag (Macintosh) to proportionally resize a vector shape.
6 To specify the rate at which the gradient shifts between colors, use the Spread control to enter a percentage. A setting of 100% uses the entire width or height of the shape to gradually shift colors. Lower settings make the shift more abrupt. For settings over 100%, the end color is reached at a theoretical location beyond the edges of the shape. 7 To rotate the gradient within the shape, use the Angle control to enter the number of degrees. This setting affects only linear gradients.
3 To set specific vector shape settings, click the Vector tab. 4 To set the stroke color, choose a color from the Color menu, or enter a color value in the Stroke Color text box. 5 To set the width of the stroke, use the Width slider. 6 To set the fill color, select a color from the Color menu, or enter a color value in the Fill Color text box. 7 To set the type of fill, select one of these three options: No Fill, Solid, or Gradient. 8 To change the setting for anti-aliasing, click Anti-alias.
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 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 field on the Member tab to view or edit the cast member name.
CHAPTER 9 Color, Tempo, and Transitions Several behind-the-scenes functions in Macromedia Director MX 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. See “About tempo” on page 267.
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. When a computer is set to display 256 colors or fewer, it can display only the colors in the palette currently active in the system. This means that images created to display with the colors of one palette do not appear correctly when a different palette is active.
Choosing colors for movie elements Use the Color menu to select colors for movie elements such as the Stage, vector shapes, and the foreground and background of sprites. For some elements, such as Stage and sprite colors, you can also enter hexadecimal values for any RGB color. The Color menu displays the colors in the current palette; the 16 larger color boxes at the top of the menu identify your favorite colors.
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. 3 Use the color picker that appears to select colors. To edit the favorite colors on the Color menu: 1 Open the Color menu. 2 Select Edit Favorite Colors.
4 Select a new color for the box using one of the following options: • Click the color box to open the Color menu and select a color from the current palette. • Enter an RGB value for a color in the box to the right of the color box. • Click Color Picker and then use the system color picker to specify a new color. 5 Click OK.
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 Reserve, select, and rearrange colors Tools 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.
6 Select all the cast members that use the old version of the palette, or use Find to locate all the cast members using a particular palette. 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.
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 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.
Changing colors in a color palette You can define a new color for a color palette by selecting a color you want to change and then using either the controls at the bottom of the Color Palettes window or the system color. Open the color picker Define a new color by hue, saturation, and brightness 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.
Controlling color palettes with Lingo By using the puppetPalette command, you can change the current palette and specify how quickly a new palette fades in. This command is useful when you want to change the palette to suit changing conditions in the movie without entering a new frame. For example, you can change the palette when you switch a cast member assigned to a sprite.
• If the Import option for Palette in the Image Options dialog box is not available while you are importing an image, the image’s palette might not meet standard system requirements. Note: Use an image editor to make sure the image’s palette meets the following requirements: The palette must contain exactly 16 or 256 colors. The first and last colors in the palette must be black or white, and there must be only one black and one white in the entire palette.
About tempo Tempo is the number of frames per second that Director tries to play. You can control tempo using the Score tempo channel or Lingo’s puppetTempo command. 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 you’ve set 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 10 Text Macromedia Director MX creates text that is editable, anti-aliased, and compact for fast downloading in any font on any platform. Combine these features with any of the animation capabilities of Director, such as rotation, and you can create text effects that are not possible in any other application. 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 will display 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: • Use the recordFont command. See recordFont in the Lingo Dictionary. 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. To create text cast members directly on the Stage: 1 Click the Text tool in the Tool palette. 2 Drag the pointer on the Stage to create a text cast member.
Importing text You can import text from any application that saves text in rich text format (RTF), in plain text (ASCII), or from HTML documents. Use the standard importing procedure with File > Import to import any RTF, ASCII, or HTML document. To import an HTML document from the Internet, click the Internet button in the Import dialog box (File > Import) and enter a URL in the File URL text box.
Selecting and editing text on the Stage For basic text editing, it’s fastest to edit text directly on the Stage. To edit text on the Stage: 1 Click a text cast member on the Stage to select it as a sprite. The text sprite appears as a normal sprite with double borders. 2 Click twice to edit the text. An insertion point appears in the text, and you can begin editing. 3 Use the Text inspector (Window > Text Inspector) to reformat the text.
Formatting characters After you created text cast members for your movie, you can format them in several ways: You can set the font, style, size, line spacing, and color. The following procedure uses the Font dialog box, but many of the same options are available in the Text inspector and the Text window. To format characters: 1 Double-click inside a text sprite. 2 Drag to select the text you want to format. 3 Select Modify > Font to open the Font dialog box.
4 To define tabs, use any of the following options: • Set a tab by clicking the Tab button until the type of tab you want appears. Then click the ruler to place the tab. Tab button Left tab Right tab Decimal tab Center tab • Move a tab by dragging the tab marker on the ruler. • Remove a tab by dragging the tab marker up or down off the ruler. 5 To set margins, drag the indent markers on the ruler.
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.
Using anti-aliased text dramatically improves the quality of large text on the Stage, but it can blur or distort smaller text. Experiment with the size settings to get the best results for the font you are using. Director can anti-alias all outline (TrueType, PostScript, and embedded) fonts but not bitmap fonts. When you select a font that cannot be anti-aliased, the message “This font cannot be antialiased” appears in the Font dialog box below the font list.
7 To set additional search options, select Wrap-Around, Whole Words Only, or Case Sensitive. specifies whether Director returns to the beginning of text after it reaches the end. If you select this option but not All Casts, Director continues searching from the top of the current text after it reaches the bottom of the window.
To create a field cast member: 1 Perform one of the following actions: • Select Insert > Control > Field. • Click the Field tool in the Tool palette, and drag on the Stage to define the area of the field. Field tool The field is created, and an insertion point is placed at the beginning of the field. 2 Enter the text for the field. When you finish, click outside the field to exit the field. To specify field settings: • Select Window > Field, or double-click a field cast member in the Cast window.
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 using the Graphical view. 3 Click Editable. To control whether text is editable with Lingo: • Set the editable property. See editable in the Lingo Dictionary.
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.
9 To determine how Director places text within the boundaries of the cast member, select one of the following Framing options: expands the text box vertically when text that is entered extends beyond the current size of the box. Adjust to Fit attaches a scroll bar to the right side of the text box. This is useful when there is a large amount of text.
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 chunks of text with Lingo The Director interface lets you format a variety of text characteristics, such as the font, size, style, and line spacing. Using Lingo, you can format text dynamically as the movie plays. You can also use Lingo to rapidly format text during authoring. Formatting text with Lingo Lingo can format text in an entire cast member or any specific chunk of text using the following properties. See entries for individual properties in the Lingo Dictionary.
Formatting text or field cast members with Lingo In addition to formatting text in any chunk expression, Lingo can specify anti-aliasing and kerning for an entire text cast member and control the appearance of the text’s bounding rectangle. Setting anti-aliasing and kerning with Lingo You can use Lingo to specify anti-aliasing and kerning for a text cast member. See entries for individual properties in the Lingo Dictionary.
Controlling scrolling text with Lingo Lingo can 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").scrollTop = 0 This procedure can be useful for making a scrolling field automatically scroll back to the top.
Modifying strings with Lingo 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. See individual entries in the Lingo Dictionary. • To set the entire content of a text or field cast member, set the text cast member property to a new chunk of text.
Chapter 10
CHAPTER 11 Using Flash and Other Interactive Media Types To add complex media and new capabilities to your Macromedia Director MX movie, you can use Macromedia Flash movies, other Director movies, and ActiveX controls. Each of these multimedia formats has interactive capabilities that are preserved by Director. A Flash movie in a Director movie provides a vector-based, scalable, interactive animation that is optimized for use on the web.
Flash movies are particularly effective for use in Shockwave movies because, as vector-based media, they are extremely small and therefore load much more quickly than most other media types. Because Flash movies are vector-based, you can scale and rotate them while still maintaining their sharpness.
4 Select Playback options to control how a Flash movie sprite plays in a Director projector, in a Shockwave movie, and while you are authoring in Director: displays the image of the Flash movie when it plays. When Image is deselected, the Flash movie is invisible. Image Sound enables any sound in the Flash movie to play. When Sound is deselected, the movie plays without sound. Paused displays only the first frame of the movie without playing the movie.
9 When you have finished selecting options, click OK. Director adds the Flash movie to the cast. Note: You can also use Lingo extensions to adjust these and other properties of the Flash movie. See “Controlling a Flash movie with Lingo” on page 297. About using a Flash movie in a Director movie Once you have added a Flash movie 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.
If you install Flash MX before installing Director, Flash is added to the list of external editors automatically when you install Director. If you install Flash MX after installing Director, you can enable Flash launch and edit by adding Flash MX to the list of external editors. To add Flash MX to the list of external editors: 1 Select Edit > Preferences > Editors. 2 Select Flash, and click Edit. 3 Select Use External Editor, and click Browse. 4 Browse to the location of your Flash MX application.
Flipping, rotating, and skewing Flash sprites Lingo can flip, rotate, and skew Flash sprites as the movie plays. For more information, see the Lingo Dictionary. • 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 a Flash movie’s bounding rectangle and registration points You can use to Lingo to control a Flash movie’s bounding rectangle and to set a Flash movie’s registration points. For more information, see the Lingo Dictionary. • To control which part of a Flash movie appears within its sprite’s bounding rectangle, set the viewH, viewpoint, viewScale, and viewV properties. • To control the default size for all new Flash sprites, set the defaultRect property.
Streaming Flash movies with Lingo In addition to the Lingo that lets you stream many of the Director media types, Director offers Lingo that specifically lets you control and monitor streaming Flash movies. For general information about using Lingo to stream media in Director, see Chapter 27, “Using Shockwave Player,” on page 591. For more information on specific Lingo functions and commands, see the Lingo Dictionary. • To specify whether a linked movie streams or not, set the preLoad property.
• To stop a Flash movie at its current frame but let any audio continue to play, use the hold command. • To specify a separate timeline within a Flash cast member as the target of subsequent Lingo sprite commands, use the tellTarget() and endTellTarget() commands. • To call a series of actions that reside in a frame of a Flash movie sprite, use the callFrame() command. Controlling Flash movie interactivity with Lingo Lingo can control whether a Flash movie remains interactive.
In previous versions of Director, there were only three possible return values for this function: #background, #normal, and #button. In Director 8.5 and later, there is a fourth return value possible: #editText. This value indicates that an editable text field within the Flash sprite is over the specified location. See getVariable(), setVariable(), and hitTest() in the Lingo Dicitonary. Sending Lingo instructions from Flash movies A Flash movie can send Lingo instructions to a Director movie.
• To specify an event message, specify the word event followed by a colon, the name of a handler you will write in Director, and a parameter (if any) to pass along with the event.
Using Flash objects in Lingo With Director MX, you can create Flash ActionScript objects and access all of their properties and methods. You can create a wide variety of Flash objects, including arrays, dates, Booleans, XML objects, and net connection objects for use with Flash Communication Server MX. If you have authored a Flash movie that contains ActionScript classes that generate custom objects, you can access those objects in Lingo as well.
• To access a property of the object, such as the array’s length, you only need to refer to the property as a property of the object reference you created: put myNewFlashObject.length -- 3 • To access a part of the object, such as the value of the third item in the array, use the following syntax: put myNewFlashObject[2] -- "banana" Note: The items in an ActionScript array are numbered beginning with zero, while the items in a Lingo list are numbered beginning with one.
Using the Flash local connection object Macromedia Flash MX 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. Because the local connection object is a Flash object supported in Director, it can allow communication between separate Flash movies, Director movies, or combinations of the two.
Setting up callbacks The next step is to set up callback handlers with the setCallback() command. 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.
Writing callback handlers Now the callbacks are set up. In order for them to work, however, you must write the callback handlers themselves. While the setCallback() commands are all inside a beginSprite handler in this example, the callback handlers must be outside the beginSprite handler because they are handlers by themselves. In this example, the callback handlers are located in the same Lingo script attached to the Flash sprite, just after the beginSprite handler.
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() command and all the setCallback() commands, you must add a connect() command. This is actually a Flash ActionScript command that you send to the local connection object you created. pLocalConn.
The steps required to communicate with Flash Communication Server MX are identical to those you would use in ActionScript. To create a NetConnection object: • Use the Lingo newObject() command. myNetConObject = sprite(1).newObject("NetConnection") To create a NetStream object: • Use the newObject() command and include the NetConnection object as a parameter: myStream = sprite(1).
To receive a video stream from the server, the stream must be attached to a video clip instance in a Flash sprite. A sample Flash movie containing a video clip object is included in the Macromedia/ Support/Flash/ folder on the Director installation CD. To create a Lingo reference to the video clip object in the Flash sprite: • Use the getVariable() command. videoRef = sprite(1).
Emulating the Flash Player context menu in Shockwave You might decide that you want to allow users to access the Settings panel by right-clicking (Windows) or Control-clicking (Macintosh) on your Flash sprite when your movie is playing in a browser. To do this, you must first disable the context menu that is built into the Shockwave Player. After the Shockwave context menu is disabled, you can trigger the Flash Settings panel by right-clicking or Control-clicking.
• Use Copy ink if possible. Transparency, using Background Transparent ink, requires much more processing time. If your Flash sprite is in the background (no other Director sprites are behind it), use Copy instead of Background Transparent, and author your Flash movie in such a way that its background color is the same as the background color you chose for your Director Stage. • Use Direct to Stage if possible.
For both types of imported movies, the host movie controls the tempo settings, palette settings, and transitions. Settings for these functions in the imported movie are ignored. Once it is imported, the movie appears as a cast member in the Cast window. The cast members of a movie imported as internal media also appear in the Cast window. You can animate the cast member just as you would any graphic cast member, film loop, or digital video. To import a Director movie: 1 Select File > Import.
4 To view or edit the cast member name, use the Name field. 5 To add comments about the cast member, use the Comments field. 6 To specify how Director removes the cast member from memory if memory is low, select one of the following options from the Unload pop-up menu: 3—Normal sets the selected cast members to be removed from memory after any priority 2 cast members have been removed. 2—Next 1—Last sets the selected cast members to be among the first removed from memory.
Using ActiveX controls In Director movies that you intend to publish only as projectors for Windows, you can embed ActiveX (formerly known as OLE/OCX controls) controls that let you take advantage of the technology and adapt ActiveX controls to make them function as sprites in Director. You can use ActiveX controls to manage application resources for the hosted ActiveX control—for instance, to manage properties, events, and windows and filing properties.
Setting ActiveX control properties An ActiveX control describes its information using properties—named characteristics or values such as color, text, font, and so on. Properties can include not only visual aspects but also behavioral ones. For example, a button might have a property that indicates whether the button is momentary or push-on/push-off. An ActiveX control’s properties define its state—some or all of which properties may persist.
As an example, if the Microsoft Access Calendar control is inserted into a Director movie as the second sprite on the Score, the following Lingo code would increment the year displayed within the Calendar control: sprite(2).NextYear() For the same Calendar control, the following Lingo code would decrement the year displayed by the Calendar control: sprite(2).PrevYear() Parameters passed to the ActiveX control are automatically converted from their Director data types to equivalent ActiveX data types.
CHAPTER 12 Sound and Synchronization You can give your movie added appeal by including a soundtrack, a voice-over, ambient noises, or other sounds. With Macromedia Director MX, 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.
Importing internal and linked sounds Director handles sounds as either internal or linked. You can determine whether a sound is internal or linked when you import it. Each type of sound has advantages for different situations. Director stores all the sound data for an internal sound cast member in a movie or cast file and loads the sound completely into RAM before playing it. After an internal sound is loaded, it plays very quickly.
Setting sound cast member properties You can use sound cast member properties to make a sound loop, change its name, change the external sound file to which it’s linked (if it’s a linked sound), and set its unload priority. To set sound cast member properties: 1 Select a sound cast member. 2 Click the Sound tab in the Property inspector.
In addition to the two sound channels in the Score, Director can use as many as six additional sound channels simultaneously. However, the additional channels are accessible only from Lingo or from behaviors. Available RAM and the computer’s speed are the constraints on how many sounds Director can use effectively. To place a sound in the Score: 1 If the sound channels are not visible, click the Hide/Show Effects Channels button at the upper right side of the Score.
Using sound in Windows The following issues are specific to managing sound for Windows: • In Windows, a sound that is already playing in either sound channel overrides the sound in a QuickTime or AVI video or in a Flash movie. It also prevents the video sound from playing even after the sound in the sound channel stops. After the sound in a digital video starts, however, it overrides a sound in either sound channel.
These statements queue the sound members Explosion and Siren and play them in succession in sound channel 2: sound(2).queue(member("Explosion")) sound(2).queue(member("Siren")) sound(2).play() To control how a queued sound plays: • Include optional parameters in a property list within the queue() function. See queue() in the Lingo Dictionary. When you use setPlayList(), any previously set queue of sounds is replaced by the new playlist.
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.
Compressing internal sounds with Shockwave Audio Shockwave Audio can compress any internal sounds in a movie. Although internal sounds are not streamed, compressing them with Shockwave Audio dramatically decreases the size of the sound data in a movie, shortens the download time from the Internet, and saves disk space. You can use Shockwave Audio settings to specify compression settings for internal sound cast members. The selected compression settings apply to all internal sound cast members.
To stream a linked Shockwave Audio or MP3 sound: 1 Select Insert > Media Element > Shockwave Audio. This process creates a cast member that controls the streaming Shockwave Audio. 2 In the SWA Cast Member Properties dialog box that appears, click Browse and select a Shockwave Audio file on a local disk, or enter a URL in the Link Address box. Unless you select a file in the same folder as the movie, the movie always links to the exact location that you specify. Be sure to link to the correct location.
• To stop a streaming sound file, use the stop member command. • To determine the state of a streaming sound file, test the state cast member property. • To determine whether an error occurred when streaming a sound file, use the getError() function. • To obtain a string describing an error that occurred when streaming a sound file, use the getErrorString() function. • To determine the length of a streaming sound file, use the duration cast member command.
To use cue points: 1 Place cue points in a sound file or (on the Macintosh only) in a QuickTime file. Use an audio-editing program to define cue points in sounds and digital videos. 2 Import the sound or digital video into Director. Note: Digital video is always linked, whether you select the Standard Import option or the Link to External File option in the Import dialog box.
Chapter 12
CHAPTER 13 Using Video You can give your Macromedia Director MX 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 QuickTime VR. Director supports QuickTime video for Windows and Macintosh, and Video for Windows (AVI). Director also supports RealMedia content (Windows only). QuickTime is a multimedia format in its own right.
Importing digital video When you import QuickTime, RealMedia, or AVI digital video, the cast members you create always remain linked to the original external file, even if you select the Standard Import option. When you distribute a movie, you must always include all digital video files along with the movie. QuickTime must be installed on a computer in order to author or play back a movie that contains QuickTime digital video.
Setting digital video cast member properties Use cast member properties to control the media in a digital video, specify how it is framed and whether it plays direct-to-Stage, and set other important options. To set digital video cast member properties: 1 Select a digital video cast member in the cast. 2 Click the Member tab in the Property inspector.
Paused stops the digital video when it first appears on the Stage (while playing the Director movie). Loop replays the digital video continuously from the beginning to the end. (AVI only) loads the cast member into memory when the movie starts. For more information, see “Preloading AVI digital video” on page 341. Preload Streaming (QuickTime only) begins playing the video while the rest of the video continues to load from its source.
4 If Direct to Stage is selected, select one of the following Playback options: makes the digital video skip frames (if necessary) to keep up with its soundtrack. The digital video might also take less time to play. Sync to Soundtrack 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 Lingo can take advantage of the most important and powerful features of digital video. Besides playing digital video linearly, Lingo 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. This last feature is especially useful for AVI digital video, which has no control panel.
• 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. • To determine the time of the track before the current time in a digital video, check the digital video’s trackPreviousSampleTime cast member property and trackPreviousKeyTime sprite property.
Responding to user interaction Lingo lets you control how QuickTime VR responds when the user clicks a QuickTime VR sprite. Use Lingo to specify how Director handles image quality, clicks and rollovers on a QuickTime VR sprite, clicks on hotspots, and interactions with QuickTime VR nodes. For more information, see the Lingo Dictionary. • To set the codec quality to use when the user drags on a QuickTime VR sprite, set the motionQuality sprite property.
Panning QuickTime VR Use Lingo to pan a QuickTime VR digital video without the user dragging the image, as described in the following list. For more information, see the Lingo Dictionary. • To set the current pan of the QuickTime VR sprite, set the pan QuickTime VR sprite property. • To nudge a QuickTime VR sprite in a specific direction, use the nudge command. Displaying QuickTime video Lingo can control how a movie displays QuickTime videos, as described in the following list.
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 will 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.
RealNetworks RealAudio and RealVideo formats are recognized as the standard for streaming media content on the web today.
Macromedia, Director, Lingo, Shockwave, and Xtra are trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, servicemarks, or tradenames of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally.
RealMedia cast members RealMedia cast members are always linked cast members; they reference an external stream via a URL (of type HTTP, RTSP, or PNM) to a location on the Internet or a local file on your hard disk or network file server. RealMedia cast members are always of type #realMedia.
• If you use RealPlayer native audio to process RealAudio, all Lingo sound elements and the audio property in the Property inspector are ignored. You enable RealPlayer native audio by setting the realPlayerNativeAudio() function to TRUE. This function should be executed in a prepareMovie event handler in a movie script.
Streaming of RealMedia cast members is handled by RealPlayer, not the Shockwave player. Since the streaming of RealMedia cast members is independent of the streaming functionality of Director, RealMedia cast members are not placed in the Director cache, and NetLingo does not apply to RealMedia cast members. Authoring tips Review the following guidelines before you begin creating RealMedia cast members and assembling your movie.
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 details, see “The RealMedia tab in the Property inspector” on page 349.
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 Lingo properties for RealMedia. Even if you are not planning to use the Lingo properties, it is a good idea to read the Lingo entries for the properties that appear in the Property inspector because they contain valuable information.
• userName (RealMedia) • password allows you to specify a password if 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 ********. the cast member references a protected URL. For security purposes, after a password has been entered, it cannot be retrieved.
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. As stream buffering progresses, the width of the sprite increases from 0 to 100%. lets a text area or field display text information for the RealMedia sprite with the RealMedia Target behavior attached.
You can create as many of these features as you like. You do not have to use control buttons in movies with RealMedia cast members if you want to control them from the Score or using Lingo. The RealMedia viewer The new RealMedia viewer is a simple media viewer that lets you play RealMedia cast members in isolation from other elements of your movie. You cannot edit RealMedia cast members in the RealMedia viewer.
Rewind stops playback, empties the stream buffer, and resets the stream to the beginning. This is equivalent to the stop (RealMedia) command in Lingo. stops the playback but does not reset the stream to the beginning or empty the stream buffer. If the user clicks Play after clicking Stop, play resumes where it left off, without rebuffering (unless it is a live stream, in which case it rebuffers to join the live stream in progress). This is equivalent to the pause (RealMedia) command in Lingo.
Using Lingo sound elements with RealMedia All the Lingo elements in this section are documented in the main Lingo Dictionary and are discussed here only as they pertain to working with RealMedia content. For complete information, see the Lingo Dictionary.
Unsupported sound elements The following Lingo 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 playNext() puppetSound queue() rewind() sampleCount setPlayList() soundClose (obsolete) sound playFile status (use the state (RealMedia) or mediaStatus RealMedia cast member properties instead) Using
Chapter 13
CHAPTER 14 Behaviors A behavior in Macromedia Director MX is prewritten Lingo script 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. See “Getting information about behaviors” on page 361. The behaviors included with Director come with descriptions.
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 an internal cast, to prevent you from accidentally changing the original behavior.
3 Select a behavior from the Behaviors pop-up menu. Director attaches the behavior you select to the sprite(s) or frame(s). Note: Some behaviors work only when applied to either a sprite or a frame; for more information, read the behavior descriptions. To change parameters for a behavior attached to a sprite or frame: 1 Select the sprite or frame to which the behavior is attached. 2 In the Behavior tab of the Property inspector, use the pop-up menus or text fields to change any parameters.
Getting information about behaviors Behaviors included with Director have pop-up descriptions that appear when you hold the pointer over a behavior in the Library palette. Some behaviors, however, have longer descriptions and instructions, which you can view in the Behavior inspector. A scrolling pane in the Behavior inspector displays the complete description provided by the behavior’s author. The Behavior inspector only displays information about a behavior attached to a sprite or frame.
Using the Behavior inspector is a good way to learn Lingo. You can examine the scripts created by the Behavior inspector to see how basic functions are assembled. Select any behavior and click the Script button to view the associated Lingo script. All behaviors detect an event and then perform one or more actions in response. The Behavior inspector lists the most common events and actions used in behaviors.
2 Click the arrow in the lower left of the Behavior inspector to expand the editing pane. Click here to expand the editing pane The editing pane shows the events and actions in the current behavior. If you’re creating a new behavior, no events or actions appear. • To add a new event or action group to the behavior, select an event from the Events pop-up menu and then select actions for the event from the Actions pop-up menu. You can choose as many actions as you need for a single event.
indicates that the right mouse button was released. (On the Macintosh, Director treats a Control-click the same as a right mouse click on a Windows system.) Right Mouse Up indicates that the right mouse button was clicked. Right Mouse Down indicates that the pointer entered a sprite’s region. Mouse Enter Mouse Leave indicates Mouse Within Key Up that the pointer left a sprite’s region. indicates that the pointer is within the sprite’s region. indicates that a key was released.
executes any Lingo function or sends a message to a handler. You specify the new handler’s name. New Action Writing behaviors with Lingo If you are familiar with Lingo, you can author your own behaviors. From the perspective of Lingo, a behavior is a script with these additional features: • Each instance of the behavior has independent values for properties. Lingo uses a property statement to declare properties that can have independent values in each instance of the behavior.
To allow users to set different values for a property in different instances of the behavior, the behavior’s script needs two types of Lingo: • A property statement that allows each instance to maintain a separate value for the property • An on getPropertyDescriptionList handler that sets up the property Setting behavior properties with Lingo Behaviors usually have properties for which each instance of the behavior maintains its own values.
For example, to define the property movement as an integer that can be set to a value from 1 to 10 and whose default value is 5, use a phrase similar to this: #movement: [#default: 5, #format:#integer, ¬ #comment: "Set motion to the right:", #range: [#min:1, #max:10]] • #movement is the property’s name. A symbol (#) operator must precede the name in the property definition. A colon separates the name’s definition and the list of parameters.
For example, this handler creates a property list named Description that contains the definitions for movement and whichSound: on getPropertyDescriptionList set description = [:] addProp description, #Movement, [#default: 5, #format:#integer, #comment: ¬ "Set motion to the right:", #range: [#min:1, #max:10]] addProp description, #noise, [#default:"", format: #sound, ¬ #comment:"Sound cast member name"] return description end Alternatively, you can use this syntax to do the same as the previous handler: on
Example of a complete behavior If the handlers described here were in one behavior, the script would look like this (the puppetSound command was added to the on mouseUp handler in this example): property movement, noise on getPropertyDescriptionList set description = [:] addProp description, #movement, [#default: 5, ¬ #format:#integer, #comment: "Set motion to ¬ the right:", #range: [#min:1, #max:10]] addProp description, #noise, [#default:"", ¬ #format: #sound, #comment:"Sound cast ¬ member name"] return d
For example, this handler sends the custom message bumpCounter and the argument 2 to sprite 1 when the user clicks the mouse: on mouseDown me sendSprite (1, #bumpCounter, 2) end Note: The symbol (#) operator must precede the message in the sendSprite command. Sending messages to all sprites The sendAllSprites command sends a message to every sprite in the frame.
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, Lingo uses the property or handler in the behavior instead of the one in the ancestor.
Chapter 14
CHAPTER 15 Navigation and User Interaction Adding interactivity lets you involve your audience in your Macromedia Director MX 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.
Creating basic navigation controls with behaviors Director provides behaviors that let you create basic navigation controls without knowing Lingo. You can use behaviors to move the playhead to a frame number or marker. You can also stop the playhead at any frame and wait for the user to act. The following examples explain the basic use of the Hold on Current Frame and Go Next Button behaviors. You can also create custom navigation behaviors or get them from third-party developers.
Setting properties for push buttons, radio buttons, and check boxes When you create a push button, radio button, or check box on the Stage, a Button cast member is added to the Cast. You can use button cast member properties to change the name and button type of button cast members. To view or change button cast member properties: 1 Select a button cast member (a push button, radio button, or check box) and click the Member tab of the Property inspector using the Graphical view.
Jumping to a URL Lingo lets you jump to a URL that represents an Internet movie or a web page. • To jump to an Internet movie, use the gotoNetMovie command. For example, the statement gotoNetMovie "http://www.yourserver.com/movies/ retrieves and plays the movie named movie1.dcr. See gotoNetMovie in the Lingo Dictionary. movie1.dcr" • To jump to a web page, use the gotoNetPage command. For example, the statement gotoNetPage "http://www.yourserver.com/movies/ intro.html" displays the web page named intro.
Detecting mouse clicks with Lingo Users can click the mouse button in several ways, each of which Lingo can detect. The following are ways that you can use Lingo to detect what the user does with the mouse. See individual properties and functions in the Lingo Dictionary. • To determine the last place the mouse was clicked, use the clickLoc() function. • To determine the last active sprite (a sprite with a script attached) that the user clicked, use the clickOn • • • • • function.
To make a text sprite editable: • Click the Editable button in the Property inspector. Moveable button Editable button Making sprites editable or moveable with Lingo Lingo can make sprites editable or moveable regardless of the settings in the Score. You can also use Lingo to constrain a moveable sprite to a certain region. For example, you can create a draggable slider with an indicator that moves across a gauge. For more information, see individual properties and functions in the Lingo Dictionary.
Checking which text is under the pointer with Lingo Lingo can detect which text component in a text or field cast member is currently under the mouse pointer. See individual properties and functions in the Lingo Dictionary. Use Lingo 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() function.
Finding mouse pointer locations with Lingo Determining where the mouse pointer is on the Stage is a common need in Director. To determine the mouse pointer’s horizontal and vertical positions: • Use the mouseH() and mouseV() functions. See mouseH and mouseV in the Lingo Dictionary. The mouseV() function returns the distance, in pixels, between the mouse pointer and the upper left corner of the Stage.
Lingo term Windows key Macintosh key optionDown Alt Option controlDown Control Control ENTER Enter key on the numeric keypad (during authoring, pressing Enter starts playing the movie) Enter key on the numeric keypad (during authoring, pressing Enter starts playing the movie) BACKSPACE Backspace Delete Identifying keys on different keyboards Characters can vary on different keyboards. You can avoid possible confusion by identifying a character by its ASCII value.
Requirements for animated color cursors All cast members used for an animated color cursor must meet certain criteria: • They must be bitmap cast members. • They must have a color depth of 8 bits (256 colors). • They must use only the first eight or the last eight colors that are in the standard System - Win palette. These colors provide the most predictable results when playing back across platforms. Other colors might not appear correctly.
4 Select the cast member you want, and click Add. You see the cast member in the Cursor Frames preview area. The Frame X of Y field shows where the cast member falls within an animated series of cursor frames. 5 Repeat steps 2 through 4 until you have added all the cast members for the cursor. In the Cursor Frames area, you can use the < and > buttons to review the order of the cursor frames.
Using an animated color cursor in a movie After you add an animated color cursor to the cast, use Lingo 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 command: cursor (member whichCursorCastMember) For whichCursorCastMember, substitute a cast member name (surrounded by quotation marks) or a cast member number.
CHAPTER 16 Writing Scripts with Lingo Lingo, the scripting language of Macromedia Director MX, adds interactivity to a movie. You can use Lingo to control a movie in response to specific conditions and events. For example, Lingo can play a sound after a specified amount of the sound has streamed from the Internet. Scripting basics The information in this section introduces and explains basic Lingo scripting concepts that Director uses.
Parent scripts are special scripts that contain Lingo used to create child objects. You can use parent scripts to generate script objects that behave and respond similarly yet can still operate independently of each other. A parent script icon appears in the lower right corner of the Cast window thumbnail. For information about parent scripts, see “Using parent scripts and child objects” on page 417. Scripts attached to cast members are attached directly to a cast member, independent of the Score.
The best approach is to start simple and test your work frequently. When you get one part of a script working, start writing the next part. This approach helps you identify bugs efficiently and ensures that your Lingo is solid as you write more complex scripts. For more information about debugging scripts, see “Troubleshooting Lingo”. Performing common tasks The following are ways to perform common tasks for creating, attaching, and opening scripts.
To keep the playhead in a single frame: • In a frame behavior, type the following statement on the line after the on exitFrame statement: go to the frame The Lingo expression “the frame” always refers to the frame currently occupied by the playhead. This statement essentially tells the playhead to “go back to the frame you are currently in”. To create a sprite behavior (script attached to a sprite): • In the Score or on the Stage, select the sprite that you’re attaching the behavior to.
To open a movie script or parent script for editing: • Double-click the script in the Cast window. To change a script’s type: 1 Select the script in the Cast window or open it in the Script window. 2 Click the Script tab of the Property inspector and select a script type from the Type pop-up menu. To cycle through the scripts in the Script window: • Use the Previous Cast Member and Next Cast Member arrows at the top of the Script window to advance or back up to a script.
are terms that return a value. For example, the date() function returns the current date set in the computer. The key() function returns the key that was pressed last. Parentheses occur at the end of a function. Functions are sets of Lingo statements within a script that run when a specific event occurs in a movie (see “Using handlers” on page 396).
You can also use parentheses to override Lingo’s order of precedence in math operations or to make your Lingo statements easier to read. For example, this math expression will yield a result of 13: 5 * 3 - 2 while this expression will yield a result of 5: 5 * (3 - 2) Character spaces Words within expressions and statements are separated by spaces. Lingo ignores extra spaces. In strings of characters surrounded by quotation marks, spaces are treated as characters.
Optional keywords and abbreviated commands You can abbreviate some Lingo statements. Abbreviated versions of a command are easier to enter but may be less readable than the longer versions. The go command is a good example. All the following statements are equivalent, but the last one uses the fewest keystrokes. go to frame "This Marker" go to "This Marker" go "This Marker" It is good practice to use the same abbreviations throughout a movie so your Lingo is easier to read.
Dot syntax Dot syntax is a concise form of Lingo that makes longer scripts easier to read and comprehend for users who have at least a basic understanding of the language. By understanding and using dot syntax, you can make your scripts shorter and easier to read and debug. An understanding of dot syntax makes it easier to learn other programming languages, since many of them use dot syntax exclusively.
Using messages to identify events To run the appropriate set of Lingo statements at the right time, Director must determine what is occurring in the movie and which Lingo to run in response to certain events. Director sends messages to indicate when specific events occur in a movie, such as when sprites are clicked, keyboard keys are pressed, a movie starts, the playhead enters or exits a frame, or a script returns a certain result.
Using Lingo keywords for handler names can create confusion. Although it is possible to explicitly replace or extend the functionality of a Lingo element by using it as a handler name, this should be done only in certain advanced situations. When you have multiple handlers with similar functions, it is useful to give them names that have similar beginnings so they appear together in an alphabetical listing, such as the listing that can be displayed by the Edit > Find > Handler command.
Using handlers As described in “Using messages to identify events” on page 394, Director sends messages to handlers within scripts when specific events occur. You attach a set of handlers to an object by attaching the handlers’ script to the object. See “Creating and attaching scripts with the Script window” on page 412. Each handler begins with the word on followed by the message that the handler should respond to. The last line of the handler is the word end.
Returning results from handlers Often you want a handler to report some condition or the result of some action. To return results from a handler: • Use the return function to have a handler report a condition or the result of an action. For example, the following handler returns the current color of sprite 1: on findColor return sprite(1).foreColor end When you define a handler that returns a result, you must use parentheses after the handler when you call it from another handler.
After a handler intercepts a message, the message doesn’t automatically pass on to the remaining locations. (You can use the pass command to override this default rule and pass the message to other objects.) If no matching handler is found after the message passes to all possible locations, Director ignores the message. The exact order of objects to which Director sends a message depends on the message.
For example, the following statements have the same effect; each statement creates a linear list of three names: set workerList = ["Bruno", "Heather", "Carlos"] set workerList = list("Bruno", "Heather", "Carlos") To create an empty linear list: • Set the list to [ ]. Creating property lists The only way to create a property list is to use the list operator ([ ]). You cannot use the list() function to create a property list.
To set a value in a property list, do one of the following: • Use the equals (=) operator. (You can also use the setAProp command, which was introduced in earlier versions of Director.) For example, the statement foodList[#Bruno] associated with the property Bruno. • Use dot syntax. • For example, the statement foodList.Bruno = "sushi" = "sushi" makes sushi the new value makes sushi the new value associated with the property Bruno in the list foodList.
Adding and deleting items in a list You can add or delete items in a list by using the following commands. See entries for individual commands in the Lingo Dictionary. • • • • • • To add an item at the end of a list, use the append command. To add an item at its proper position in a sorted list, use the add or addProp command. To add an item at a specific place in a linear list, use the addAt command. To add an item at a specific position in a property list, use the addProp command.
About variables Director uses variables to store and update values. As the name implies, a variable contains a value that can be changed or updated as the movie plays. By changing the value of a variable as the movie plays, you can do things such as store a URL, track the number of times a user takes part in an online chat session, or record whether a network operation is complete. It’s a good idea always to assign a variable a known value the first time you define the variable.
Variables can also hold the results of mathematical operations. Both of these statements add the result of an addition operation to the variable mySum: mySum = 5 + 5 set mySum = 5 + 5 It’s good practice to use variable names that indicate what the variable is used for. This will make your Lingo easier to read. For example, the variable mySum indicates that the variable contains the sum of numbers.
To clear all current global variables: • Use the clearGlobals command in the Message window to set the value of all global variables to VOID. See global, clearGlobals, and showGlobals in the Lingo Dictionary. To monitor the values of global variables during movie playback, use the Object inspector. See “Using the Object inspector” on page 433. Using local variables A local variable exists only as long as the handler in which it is defined is running.
Writing strings Strings are words or groups of characters that Lingo treats as regular words instead of as variables. Strings must be enclosed in double quotation marks. For example, you might use strings to give messages to the user of your movie or to name cast members. In the statement member ("Greeting").text = "Hello" “Hello” and “Greeting” are both strings. “Hello” is the literal text being put into the text cast member; “Greeting” is the name of the cast member.
Identifying cast members and casts Note: If you rearrange (and thus renumber) cast members while creating a movie, Director doesn’t automatically update references to cast member numbers in Lingo scripts. Therefore, although some of the examples in this section illustrate how to reference cast members by number, the best practice is to always name cast members and refer to them by name in Lingo scripts.
• The word next or previous refers to the next marker or the marker before the current scene, respectively. • The term the frame followed by a minus or plus sign and the number of frames before or after the current frame refers to a frame that’s a specific number of frames before or after the current frame. For example, the frame - 20 refers to the frame 20 frames before the current frame. • The term the frameLabel identifies the label assigned to the current frame.
Expressing constants A constant is a named value whose content never changes. For example, TRUE, FALSE, VOID, and are constants because their values are always the same. EMPTY The constants BACKSPACE, ENTER, QUOTE, RETURN, SPACE, and TAB refer to keyboard characters.
Operator Effect Precedence + Performs addition. 3 - When placed between two numbers, performs subtraction. 3 Note: When only integers are used in an operation, the result is an integer. Using integers and floating-point numbers in the same calculation results in a floating-point number. When dividing one integer by another doesn’t result in a whole number, Lingo rounds the result down to the nearest integer. For example, the result of 4/3 is 1.
String operators String operators combine and define strings. These are the string operators available in Lingo: Operator Effect Precedence & Concatenates two strings. 2 && Concatenates two strings and inserts a space between the two. 2 " Marks the beginning or end of a string. 1 Controlling flow in scripts Lingo uses if...then...else, case, and repeat statements to perform an action depending on whether a condition exists. See the following sections.
For example, the following case statement tests which key the user pressed most recently and responds accordingly: case (the key) of "A": go to frame "Apple" "B", "C": puppetTransition 99 go to frame "Oranges" otherwise beep end case • If the user pressed A, the movie goes to the frame labeled Apple. • If the user pressed B or C, the movie performs the specified transition and then goes to the frame labeled Oranges. • If the user pressed any other letter key, the computer beeps.
Lingo continues to loop through the statements inside the repeat loop until the condition is no longer true or until one of the instructions sends Lingo outside the loop. In the previous example, Lingo exits the repeat loop when the mouse button is released because the mouseDown condition is no longer true. To exit a repeat loop: • Use the exit repeat command. For example, the following statements make a movie beep while the mouse button is pressed, unless the mouse pointer is over sprite 1.
6 To make new Script windows automatically format your scripts with proper indenting, select Enable for Auto Format. This option is on by default. 7 To make new Script windows display line numbers for your scripts, select Enable for Line Numbering. This option is on by default.
When an element requires additional parameters, Lingo includes placeholder names that indicate the additional required information. When more than one argument or parameter is required, Lingo highlights the first one for you, so all you have to do is type to replace it. You must select and change the other parameters yourself. Some cast member types and scripting Xtra extensions provide Lingo terms that do not appear in the Lingo menus.
Finding handlers and text in scripts The Find command in the Edit menu is useful for finding handlers and for finding and editing text and handlers. To find handlers in scripts: 1 Select Edit > Find > Handler. The Find Handler dialog box appears. The leftmost column in the Find Handler dialog box displays the name of each handler in the movie. The middle column displays the number of the cast member associated with the handler’s script. The rightmost column lists the cast that the cast member is in.
To find the next occurrence of the text specified in the Find field: • Select Edit > Find Again. To find occurrences of selected text: 1 Select the text. 2 Select Edit > Find > Selection. Using linked scripts In addition to scripts stored as internal cast members, you can choose to keep scripts in external text files and link them to your Director movie. These linked scripts are similar to linked image or digital video files you can import into Director movies.
To turn an internal script cast member into an external, linked script cast member: 1 Select the internal cast member and click the Script tab of the Property inspector. 2 Click Link Script As. 3 Enter a name for the script file in the Save As dialog box. 4 Click Save. To reload a linked script after it is edited: • Use the unloadMember command. If a linked script is edited outside of Director, you can reload it by using the unloadMember command in the Message window.
Parent script and child object basics A parent script is a set of handlers and properties that define a child object; it is not a child object itself. A child object is a self-contained, independent instance of a parent script. Children of the same parent have identical handlers and properties, so child objects in the same group can have similar responses to events and messages. Typically, parent scripts are used to build child objects that make it easier to organize movie logic.
When handlers and properties are not defined in a child object, Director searches for the handler or property in the child’s ancestors, starting with the child’s parent script. If a handler is called or a property is tested and the parent script contains no definition for it, Director searches for a definition in the ancestor script. If a definition exists in the ancestor script, that definition is used.
Creating the on new handler Each parent script typically uses an on new handler. This handler creates the new child object when another script issues a new(script parentScriptName) command, which tells the specified parent script to create a child object from itself. The on new handler in the parent script can also set the child object’s initial property values, if you want.
When referring to properties defined in ancestor scripts, you must use the me parameter as the source of the reference. This is because the property, while defined in the ancestor script, is nevertheless a property of the child object. For example, these statements both use me to refer to an object and access properties defined in an ancestor of the object: --access ancestor property x = me.
Checking child object properties You can check the values of specific property variables in individual child objects by using a simple objectName.PropertyName syntax. For example, this statement assigns the variable x the value of the carSpeed property of the child object in the variable car1: x = car1.carSpeed Querying object properties from outside the objects themselves can be useful for getting information about groups of objects, such as the average speed of all the car objects in a racing game.
To remove an object from actorList: • Use the delete command to delete the item from the list. See delete in the Lingo Dictionary. Using scriptInstanceList You can use the scriptInstanceList property to dynamically add new behaviors to a sprite. Normally, scriptInstanceList is the list of behavior instances created from the behavior initializers defined in the Score. If you add child objects created from parent scripts to this list, the child objects receive the messages sent to other behaviors.
The object’s on stepFrame handler in its parent or ancestor script will then run automatically each time the playhead advances. The object will be passed as the first argument (that is, the me argument) to the on stepFrame handler. Director doesn’t clear the contents of actorList when branching to another movie, which can cause unpredictable behavior in the new movie.
This statement creates a timeout object named timer1 that will call the on in the child object car1 every 2 seconds: accelerate handler myTimer = timeOut(“timer1”).new(2000, #accelerate, car1) To determine when the next timeout message will be sent from a particular timeout object, check its #time property. The value returned is the point in time, in milliseconds, when the next timeout message will be sent.
Troubleshooting Lingo Scripts don’t always do what you want the first time. The script often has an error in its syntax: possibly a word is misspelled or a small part of the script is missing. Other times the script might work but doesn’t produce the expected result. Mistakes or bugs almost always occur when writing Lingo, so you should allow enough time for debugging when you develop multimedia titles.
Basic debugging Debugging involves strategy and analysis, not a standard step-by-step procedure. This section describes the basic debugging approaches that programmers successfully use to debug any code, not just Lingo. Before you modify a movie significantly, always make a backup copy. Identifying the problem It might seem obvious, but the first thing to do when debugging is to identify the problem.
Solving simple problems When finding a bug, it’s a good idea to check for simple problems first. The first debugging test occurs when you close the Script window. Director gives you an error message if the script contains incorrect syntax when you close the Script window. The message usually includes the line in which the problem was first detected. A question mark appears at the spot in the line where Director first found the problem.
Using the Message window The Message window provides a way for you to test Lingo commands and to monitor what is happening in Lingo while a movie plays. To open the Message window: • Select Window > Message. Managing the Message window The Message window has an Input pane and an Output pane. The Input pane is editable. The Output pane is read-only. You can adjust the sizes of the Input and Output panes by dragging the horizontal divider that separates them.
Testing Lingo You can test Lingo commands to see how they work by entering them in the Message window and observing the results. When you enter a command in the Message window, Director executes the command immediately, regardless of whether a movie is playing. To test a one-line Lingo statement: 1 Type the statement directly in the Message window. 2 Press Enter (Windows) or Return (Macintosh). Director executes the statement.
To test a handler: 1 Type the handler in a Movie Script or Behavior Script window. 2 Type the handler name in the Message window. 3 Press Enter (Windows) or Return (Macintosh). The handler executes. Any output from put statements in the handler appears in the Message window. Like the Script window, the Message window contains pop-up menus of Lingo commands.
For example, the following line indicates several things: == Frame: 39 Script: 1 Handler: mouseUp • The movie entered frame 39. • The movie ran script 1, the first script attached to the frame. • The movie ran the on mouseUp handler in script 1 after the movie entered the frame. Entries after an arrow made up of a double hyphen and right angle bracket (-->) indicate lines of Lingo that have run.
• Check variables and expressions. Analyze how their values change as the movie plays. See if they change at the wrong time or don’t change at all. If the same variable is used in more than one handler, make sure that each handler that uses the variable states that the variable is global. You can track the values of variables and expressions by displaying their values in the Watcher pane or the Object inspector. • Make changes one at a time.
To drag an item to the Object inspector, do one of the following: • Select a sprite in the Score window and drag it to the Object inspector. • Select a cast member in the Cast window and drag it to the Object inspector. • Select a the name of an object in the Script, Message, or Text window and drag it to the Object inspector. To enter an object manually in the Object inspector: 1 Double-click in the first empty cell in the Object column of the Object inspector.
To turn off Autopoll: • Select Autopoll from the context menu again You can set the value of an object or property in the Object inspector by entering a new value in the box to the right of the object or property name. To set an object or property value: 1 Double-click the value to the right of the item name. 2 Enter the new value for the item. 3 Press Enter (Windows) or Return (Macintosh). The new value is set and reflected in your movie immediately.
Entering debugging mode In order to access the Debugger window, a break must occur in a script. A break occurs when Director encounters a script error or a breakpoint in a script. When a script error occurs, the Script Error dialog box appears. The dialog box displays information about the type of error that occurred, and asks you whether you want to debug the script, edit the script in the Script window, or cancel.
When the Debugger window opens, it shows the current line of Lingo and offers several choices for what to run next. To see which is the current line of Lingo: • Look for the green arrow next to a line of Lingo in the Script pane. The green arrow points to the current line. You can’t select a different line of Lingo by clicking it in the Script pane.
To display the variables associated with a handler in the call stack: • Click the name of the handler in the Call Stack pane. The variables appear in the Variable pane. The Variable pane includes four tabs for viewing variables: The All tab displays both global and local variables associated with the current handler. The Local tab displays The Property tab The Global tab only the local variables associated with the selected handler. displays the properties declared by the current script.
To organize objects in the Watcher pane, do one of the following: • To sort the objects in the Watcher pane, click the Name column head at the top of the left column. The object names in the column are listed in alphabetical order. • To sort the objects in reverse-alphabetical order, click the Name column head a second time. • To organize objects into groups, use the tabs in the Watcher pane. To add an object to a specific tab, click the tab you want to use before adding the object.
Editing scripts in debugging mode When you are in debugging mode, you may edit your scripts directly in the Debugger window. This way you can fix bugs as soon as you find them and continue debugging. To edit a script in the Debugger window: 1 Click in the Script pane and place the insertion point where you want to begin typing. 2 Enter the changes to the script. You can jump to a specific handler by selecting the name of the handler and clicking the Go To Handler button.
To add the selected expression or variable to the Object inspector: • Click Inspect Object. To recompile the movie’s scripts: • Click Recompile All Modified Scripts.
Chapter 16
CHAPTER 17 3D Basics Macromedia Director MX lets you bring robust, high-performance 3D graphics to the web. Director MX lets you develop a wide spectrum of 3D productions, ranging from simple text handling to interactive product demonstrations to complete immersive game environments. Using Macromedia’s free Shockwave Player 8.5, users can view your work on the web with Netscape Navigator, Microsoft Internet Explorer, or other Shockwave-supported browsers.
From 2D to 3D Because Director MX is an evolutionary development, most of what you know about Director still holds true. The following are the main components common to Director MX and earlier versions: • 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 Lingo-controlled, it involves much less direct manipulation of the Score than other Director features.
• The Behavior library lets you select the behaviors you want to use. • The Behavior inspector lets you create and modify behaviors. For an introduction to the Behavior inspector, see “3D behaviors” on page 452. For a full discussion, see “Using 3D behaviors” on page 466. Also see Chapter 3, “Director MX 3D Tutorial,” on page 103. • Director MX provides easy but powerful 3D text handling. For more information, see “Creating 3D text” on page 462. • Lingo is the Director scripting language.
The 3D Xtra The 3D Xtra lets you include 3D models in a Director movie. You can import 3D models or worlds created with a 3D modeling program and use Director to deliver them on the web. You can also combine the abilities of Director and your 3D modeling software by building a 3D world in your modeling program and adding to it or modifying it in Director. To use 3D images and text created in third-party rendering software, you must convert the file to the W3D (Web 3D) format, which Director supports.
• The camera buttons along the side—Dolly, Rotate, and Pan—let you change your viewing angle by zooming in and out, moving around the models, 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 The Property inspector lets you modify the 3D cast member without using Lingo. 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 Preload option controls how media that’s being downloaded to the user’s computer is displayed. The media can be held back from display until it has been completely streamed into memory, or it can be displayed progressively on the Stage as data becomes available. • The Play Animation option controls whether any existing animation, either bones or keyframe, is played or ignored. • The Loop option controls whether the animation loops continuously or plays once and stops.
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. Using 3D Anti-aliasing Director MX gives you the ability to use anti-aliasing with 3D cast members in your movies.
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.
3D behaviors The Director MX Behavior library includes new 3D-specific behaviors. For more information on these behaviors, see Chapter 3, “Director MX 3D Tutorial,” on page 103. 3D behaviors are divided into four types: • Local behaviors are actions that accept triggers only from the sprite to which they’re attached. • Public behaviors are actions that accept triggers from any sprite. • Triggers are behaviors that send signals to a local or public behavior to cause the behavior to execute.
The illustration that follows shows the relationships between the components of a 3D cast member: RenderServices Object (Lingo global variable) -services of the underlying 3D renderer (and any 3rd party xtras) available to all 3D cast members -Global properties of the 3D rendering state 3D Cast member A self-contained 3D world: -palettes of models, lights, shaders, animations, ect.
A model’s parent and children don’t have to be models, however. Models, lights, cameras, and groups all share the same parent-child hierarchy. A light, for example, can be the child of a group and the parent of a model. The primary benefit of these parent-child relationships is that they make it easier to move complex models around in the 3D world and to have the component parts of those models move together in the proper way.
CHAPTER 18 The 3D Cast Member, 3D Text, and 3D Behaviors This chapter introduces several Macromedia Director MX features that 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 MX 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 on sprites, see Chapter 17, “3D Basics,” on page 443. • 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 that moves the group with a single command.
The following commands and properties perform basic model resource operations: Command Function Returns modelResource. count Returns the number of model resource objects included in the cast member. Integer. modelResource. Returns the model resource named name. Returns the model resource object named name, if it exists. Returns void if the object does not exist. (name) modelResource. [index] Returns the model resource at the designated Returns the model resource object 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. Their movement results from repositioning and reorienting their geometries in 3D space. The following commands and properties can be used to perform basic model operations: Command Function Returns model.count Returns the number of model objects included in the cast member. Integer.
Command Function newShader (name,type) Creates a new shader and adds it to the shader Returns a new shader object with a object list. The type can be #standard, #painter, unique name. If the name isn’t #engraver, or #newsprint. unique, returns a Lingo error. deleteShader Deletes the shader named name. Lingo 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. Deletes the shader with the given index number.
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 commands and properties can be used to perform basic motion operations: Command 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.
Command Function Returns deleteLight (name) Deletes the light named name. Lingo references to this light persist but can do nothing. TRUE (1) if the light named name exists. FALSE (0) if the light named name doesn’t exist. deleteLight Deletes the light with the given index number. Lingo TRUE (1) if the light with this index references to this light persist but can do nothing. number exists. FALSE (0) if the light with this index number doesn’t exist.
Groups Groups are collections of models and other objects that are formally associated with one another. These associations can be created in your 3D modeling software or with Lingo. Each 3D cast member has a default group called world, which is the cast member. Groups simplify the rotation and translation of models by letting all members of a group move together with a single command. A group has a name, a transform, and a parent, and can also have children. It has no other properties.
7 Select 3D Mode from the Display pop-up menu. The text on the screen changes to 3D. You can now work with it, as discussed in the next section. Modifying 3D text After your 2D text has been changed to 3D, you can modify it. To modify the 3D text: 1 Click the Property inspector’s 3D Extruder tab. 2 Set the camera position and rotation. As with the standard 3D Property inspector tab, you control camera position and rotation with the values that you enter in the text boxes at the top of the pane.
6 Select a beveled edge type. Beveling makes the edges of the 3D letters appear rounded or angled. Select Round for rounded edges, and Miter for angled edges. 7 Select a bevel amount. This determines the size of the bevel. 8 Set up the lighting. You can select a color and position for the text’s default directional light. A directional light is a point source of light and comes from a specific, recognizable direction.
Type of Lingo Element Member command scrollByLine Member function charPosToLoc Member function linePosToLocV Member function locToCharPos Member function locVToLinePos Sprite property editable Sprite function pointInHyperLink Sprite function pointToChar Sprite function pointToItem Sprite function pointToLine Sprite function pointToParagraph Sprite function pointToWord Hypertext Lingo hyperlinkClicked Hypertext Lingo hyperlink Hypertext Lingo hyperlinks Hypertext Lingo hyperl
Property Access Description Range or Default displayFace Get and set Faces of shape to display. #front #tunnel #back Default is to show all three faces displayMode Get and set Specifies how the text appears. #modeNormal #Mode3D Default is #modeNormal, which is 2D text member(1). extrude3d (member(2)) Not applicable Creates a new model resource in member 2 by extruding the text in member 1. Member 1 must be a text cast member.
Using the 3D Behavior Library All 3D behaviors are listed in the Behavior Library. The Behavior Library is divided into two sublibraries: actions and triggers. To view 3D trigger behaviors: 1 Click the Library Palette button on the Director toolbar. 2 Click the Library List button and select 3D. 3 Select Triggers from the 3D submenu. The trigger behaviors appear, as shown in the following figure. The following table describes the available triggers.
The action behaviors appear, as shown in the following figure. 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.
Public actions As with local actions, you can add public actions to a movie by attaching them to any 3D sprite. Unlike local actions, public actions are triggered whether the trigger is attached to the same sprite as the action or to any other sprite. Public actions use the same triggers as local actions. The following table describes available public actions.
Applying 3D behaviors You apply 3D behaviors in the same way as standard behaviors in Director MX. 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 groups” on page 471.) 7 Specify options in the Parameters dialog box. 8 Click OK.
Chapter 18
CHAPTER 19 Working with Models and Model Resources This chapter covers the Lingo commands and properties used to work with models and model resources, as well as lights and cameras to enhance Macromedia Director MX three-dimensional (3D) movies. You can also find the commands and properties given here in tabular form in alphabetical form, with accompanying syntax, definitions, and examples, in the Lingo Dictionary (Help > Lingo Dictionary).
Common model resource properties The following properties are shared by all model resources: Property Name Access Description Range or Default name Get Unique string naming model resource. If imported, the name of the model. If created in Lingo, the assigned name in the constructor function. type Get Type of geometry. #plane #box #sphere #mesh #cylinder #particle #fromfile bone.count Get Total number of bones in bones hierarchy. Nonnegative integer. model Resource.
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. Their surface is generated by sweeping a two-dimensional semicircle arc in the xy plane from startAngle to endAngle in the y-axis. If startAngle = 0.0 and endAngle= 360.0, a full sphere is generated. If startAngle = 180.0 and endAngle = 360.0, a half sphere is generated. These properties can be modified or animated at runtime.
Box properties Boxes have a type property of #box. Box properties can be modified or animated at runtime. Property Access Description Value Range height Get and set Height of the box, measured along the y-axis. Positive floating-point value. The default is 50.0. width Get and set Width of the box, measured along the x-axis. Positive floating-point value. The default is 50.0. length Get and set Length of the box, measured along the z-axis. Positive floating-point value. The default is 50.0.
Plane properties Planes are the default Director MX primitive. Planes, whose type property is #plane, are generated in the xz plane with Lingo. Plane properties can be modified or animated at runtime. Property Access Description Value Range width Get and set Width of the plane Positive floating-point value. The default is 1.0. length Get and set Length of the plane Positive floating-point value. The default is 1.0.
Property Access Description Value Range colorList Get and set List identifying every color in the mesh. Any color can be shared by several faces. Alternatively, specify texture coordinates for the mesh faces and apply a shader to models using this model resource. No default. Instead, set the value to the number of colors specified in your newMesh call. face.count Get Number of triangles in the mesh. The number of faces specified in your newMesh call. face[index].
Mesh generator commands Use these commands to work with mesh primitives: Command Description Returns build() Builds the mesh according to the current property values. Nothing (The mesh construction properties specified in the previous table have no effect until build() is called.) Generates a Lingo 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 texture Get and set Texture to use when drawing each particle. The Texture object. default is void. emitter. Get and set numParticles Number of particles in a burst or stream. Positive integer. The default is 1000. emitter.mode Get and set Mode in which particles are emitted. #burst: All particles emitted at once. #stream: X particles emitted per frame with X equalling emitter. numParticles/ (lifetime*millise conds PerFrame).
Property Access Description Value Range emitter.grav Get and set ity Vector representing simulated gravity. The vector’s length indicates its strength. Any vector. emitter.wind Get and set A vector representing simulated wind pushing Any vector. particles in a given direction. The vector’s length indicates its strength. The extruder model resource You can create extruder model resources only by using an existing text cast member.
Command Description Returns cloneMotion FromCastMember (name, motion, castmember) Performs a deep clone of a motion from one cast member and puts it into another cast member. A motion object newModel Resource(name, Creates a new model resource and adds it to the model New model resource resource palette. The type can be #plane, #box, object #sphere, #cylinder, or #particle. The type cannot be #mesh. To create a new mesh model resource, use the newMesh command detailed below.
Model properties The properties of a model determine its particular appearance and relationship to the rest of the 3D world. Property Access Description Value name parent Get Unique string name. Any string. Get and set This model’s parent; either another object or the 3D An object or cast cast member itself. member. child.count Get Number of children (but not grandchildren) of a given model. An integer.
Property Access Description Value visibility Get and set The way in which the sides of the model’s resource are drawn. The choices are as follows: #none, in which no polygons are drawn and the model is invisible. #front, in which only polygons on the outer surface of the model are drawn, so that, if the camera were inside the model, the model wouldn’t be seen. Also known as “back face culling,” this option optimizes performance.
Command Description Returns clone(name) Clones a model named name, adds it to the child list of the Lingo model object model’s parent, and adds it to the world. The clone shares the same model resource, shader list, and parent as the original model, but it has unique copies of the model’s transform and modifier properties. All children of the model are automatically cloned. This can be avoided by removing the children, performing the cloning operation, and then adding the children back.
Command Description translate (xIncrement, Moves the model forward by xIncrement along the xNothing axis, yIncrement along the y-axis, and zIncrement along the z-axis. The relativeTo parameter is optional. It determines how arguments are interpreted. The possible values are as follows: #self: the default. Increments are applied relative to the model’s local coordinate system. #parent: increments are relative to the model’s parent’s coordinate system.
Moving models Because the 3D world has no absolute frame of reference, moving and rotating is much more complex than in 2D, where all movement is in relation to screen position. In 3D, everything is drawn relative to the camera’s frame of reference. If the camera is behind an object, when the object moves to the left relative to the center of the world, or world origin, it appears to move toward the right of the screen.
Properties of the standard shader The standard shader makes the surface of a model appear in a photorealistic style. Use these properties to work with the standard shader: Property Name Access Description Default name Get The string name of this shader. None ambient Get and set A Lingo color object describing the surface's reaction to ambient light. rgb(63,63, 63) diffuse Get and set A Lingo color object describing the surface's reaction to diffuse light.
Property Name Access Description Default textureList Get and set A shader can use up to eight layers of void textures. This eight-element list defines which texture is used for which layer. Get: Returns a list of texture objects, one per layer. Set: Specifies a texture object to be applied to all layers. An argument of void disables texturing for all layers. textureList [index] Get and set A shader can use up to eight layers of textures.
Property Name Access Description Default textureMode List[index] Get and set This property allows access to the texture coordinate generation function 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 .0000,0.0000 ,0.0000,0.00 00, 0.0000,50.00 00,0.0000,0. 0000, 0.0000,0.000 0,50.0000,0. 0000, 0.0000,0.000 0,0.0000,1.
Property Name Access Description Default blendFunction List[index] Get and set Access to the blending function associated #multiply 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 on all of these options, see blendFunctionList in the Lingo Dictionary.
Property Name Access Description Default blendConstant Get and set The blending ratio used for the first layer when 50.0 the blend function is set to #blend and blendSourceList[index] is set to #constant. Returns a floating-point value from 0.0 to 100.0. textureRepeat List[index] Get and set Allows you to get or set the texture clamping TRUE (1) behavior associated with a specified layer. Texture clamping refers to how a texture “clamps” to its shader.
Property Access Description Default highlight Percentage Get and set Percentage of lighting steps to be treated as highlight 50 shadowStrength Get and set Factor controlling darkness of shadowed areas 1.0 highlight Strength Get and set Factor controlling brightness of highlighted areas 1.0 Properties of the newsprint shader The #newsprint shader creates a dithering effect similar to a newspaper photograph.
Texture properties Use these properties to work with textures: Property Access Description Default name Get and set Name of texture. None type Get Possible values: None #fromfile: bitmap defined as part of 3D import #castmember: bitmap derived from Director cast member member Get and set If the type is #castmember, this property identifies the source of the bitmap. If the type if #fromfile, this property is void. None width Get Width, in pixels. None height Get Height, in pixels.
Groups Groups have many of the same properties and commands as models, except that you need to substitute the word group for the word model when writing Lingo scripts. A group can contain 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. Any string.
Group commands Use these commands to work with groups: Command Description Returns addChild(aNode, preserveWorld) 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.
Command Description translate (xIncrement, Moves the group forward by xIncrement along the x-axis, Nothing yIncrement along the y-axis, and zIncrement along the z-axis. The relativeTo parameter is optional. It determines how arguments are interpreted. The possible values are as follows: #self: the default. Increments are applied relative to the group’s local coordinate system. #parent: increments are relative to the group’s parent’s coordinate system.
Use these properties to work with the level of detail modifier: Property Access Description 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. FALSE (0) means that you can control polygon reduction on a per-model basis, provided you’ve attached the level of detail modifier to the model.
Property Access Description Default whichModel.toon. Get and set Lingo color object describing line color Black lineColor whichModel.toon. (rgb 0,0,0) Get and set silhouettes whichModel.toon. Get and set TRUE (1) or FALSE (0) value indicating TRUE (1) whether lines are drawn when mesh boundaries meet at a crease Get and set A floating-point value controlling crease angle 0.01 detection Get and set TRUE (1) or FALSE (0) value indicating creaseAngle whichModel.toon.
Use these properties to work with the SDS modifier: Property Access whichModel.sds.enable Get and set d whichModel.sds. Enables/disables subdivision surfaces modifier functionality.
Property Access Description Default whichModel.collision. Get and set TRUE (1) or FALSE (0) value indicating TRUE (1) resolve whether collisions are automatically resolved. If the value is TRUE (1) and if the other model has the collision modifier applied and has enabled set to TRUE (1), the models will be moved back to the position of their original contact. whichModel.collision. Get and set TRUE (1) or FALSE (0) value indicating immovable whether the model can be moved.
The two animation types can be combined. You might, for example, combine a “run in place” bones animation with a “move around the room” keyframe animation. Bones animations use the Bones player modifier. Keyframe animations use the Keyframe player modifier. Most commands and properties are available to both players. • Motions: A 3D cast member contains a set of motions authored in your 3D modeling application.
Bones player commands Use these commands to work with bones animations: Command Description whichModel.bonesPlayer. play(“name”, looped, startTime, endTime, playRate) Plays the motion named name starting at the Nothing time timeOffset, 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. StartTime can be an integer number of milliseconds, or it can be the symbol #synchronized.
Property Access Description whichModel. Get and set Current local time of motion at the top of the 0 play list, in milliseconds. The motion’s duration property tells you how long the animation lasts. Get and set A value indicating how quickly or slowly to play 1.0 back the motion. For example, a value of 2.0 doubles the speed of the motion; a value of 0.5 halves the speed of the motion. This value is multiplied by the value of the playRate parameter of the play or queue command.
Property Access Description Default whichModel. Get and set 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: #all bonesPlayer. rotationReset #none #x #y #z #xy #xz #all whichModel. Get and set bonesPlayer. lockTranslation Defines the axis of translation to ignore when playing back a motion.
Keyframe player commands Use these commands to work with keyframe animations: Command Description whichModel.keyframePlayer.play ("name", looped, startTime, endTime, playRate) Plays the motion named name starting at the Nothing 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. The startTime parameter can be an integer number of milliseconds, or it can be the symbol #synchronized.
Property Access Description whichModel. Get and set A value indicating how quickly or slowly to 1.0 play back the motion. For example, a value of 2.0 doubles the speed of the motion; a value of 0.5 halves the speed of the motion. This value is multiplied by the value of the playRate parameter of the play or queue command. Get Current number of motions in the play list.
Property Access Description whichModel. 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: keyframePlayer. rotationReset Returns #none #x #y #z #xy #xz #all whichModel. Get and set keyframePlayer. lockTranslation Defines the axis of translation to ignore when #none playing back a motion.
Use these properties to work with the mesh deform modifier: Property Access Description whichModel. Get Returns the number of meshes in a model. Get and set Returns a list of the vertices for the specified mesh. To modify the vertices in this mesh, set this property to a list of modified vertex positions, or modify individual vertices using bracket analysis. Get and set Returns a list of the normals for the specified mesh.
Motion properties Use these properties to work with motions: Property Access Returns name Get Name of motion. duration Get Time in milliseconds motion needs to play to completion. type Get The type of motion with the following values: #keyFrame: suitable for use with the Keyframe player #bones: suitable for use with the Bones player #none: no mapping has been made for this motion The default is #none.
Light properties Use these properties to work with lights: Property Name Access Description 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 this light’s parent. If the light has no parent, it cannot contribute light. Group ("World") child.count Get Number of immediate children (no grandchildren) that the light has.
Property Name Access Description Default spotDecay Get and set TRUE (1)/FALSE (0) value that controls FALSE (0) whether or not spotlight intensity falls off with camera distance. None pointAt Orientation Get and set boundingSphere Get A list containing a vector and a floating-point [vector value, with the vector representing the position (0,0,0), and the value the radius of a bounding sphere 0.0] surrounding the light and all its children.
Command Description Returns registerScript (eventName, handlerName, scriptInstance) Registers a handler named handlerName that is called in the instance scriptInstance when the event eventName occurs. If scriptInstance is 0, a movie script handler called eventName is called. The user defines what eventName is.
Cameras Cameras act as view ports into the 3D world. By default, a newly added camera’s view is positioned at the world’s origin, the vector (0,0,0), and looks down the negative z-axis. Changing a camera’s transform property affects the camera’s position and orientation. When a 3D sprite is created from a 3D cast member, the sprite uses one of the cast member’s cameras. Changing the camera that the sprite is using changes what’s seen in the sprite. Cameras can also have overlays and backdrops.
Property Name Access Description Default colorBuffer. clearAtRender Get and set TRUE (1) or FALSE (0) TRUE (1) colorBuffer. clearValue Get and set Lingo color object defining color used to clear out buffer if colorBuffer.clearAtRender is TRUE (1). rgb(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 overlay[index]. rotation Get and set Rotation value used by a specific overlay in O, O the camera’s list of overlays. overlay[index]. blend Get and set Blend value used by a specific overlay in the camera’s list of overlays. 100 is fully opaque; 0 is fully transparent. 100.0 overlay.count Get and set Number of overlays in use on this sprite.
Camera commands Use these commands to work with cameras: Command Description addChild(aNode, preserveWorld) Nothing Adds aNode to this camera’s list of children. An equivalent operation is to set aNode.parent to equal thisCamera. The preserveWorld argument is optional.I t can have two values: #preserveWorld or #preserveParent. If the value is #preserveWorld, the world transform of the child being added remains intact. If #preserveParent, the child’s transform is interpreted as remaining parent-relative.
Command Description Returns translate (xIncrement, yIncrement, zIncrement, relativeTo) Nothing Moves the camera forward by xIncrement along the x-axis, yIncrement along the y-axis, and zIncrement along the zaxis. The relativeTo parameter is optional. It determines how arguments are interpreted. The possible values are as follows: #self: the default. Increments are applied relative to the camera’s local coordinate system. #parent: increments are relative to the camera’s parent’s coordinate system.
Chapter 19
CHAPTER 20 Controlling the 3D World Macromedia Director MX provides powerful methods for overall control of the three-dimensional (3D) world, including Lingo for handling new 3D-generated 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 commands to set up event handling: Command 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.
Property Access Description pointOf Contact Get Vector describing world-space location of collision. Available only if the collision has been resolved. Occurs if the model’s collision modifier resolve property is TRUE (1) or either the collisionData resolveA() or collisionData resolveB() method is called. collision Normal Get Vector indicating direction of collision. Available only if the collision has been resolved.
Camera commands These camera functions allow you to 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. Function Description Returns worldSpaceTo SpriteSpace (vector) Returns the 2D sprite-space coordinates of a point from a 3D world vector. A point.
Vector creation commands Use these functions to create vectors: Function Description Returns vector (x,y,z) Creates a vector from arguments representing all axes. A vector object random Vector() Creates a vector describing a randomly chosen point on the surface of a unit sphere. Differs from vector(random(10)/ 10.0, random(10)/10.0, random(10)/10.0) because the randomVector() method always results in a unit vector.
Command Description Returns distanceTo (vector2) Returns the distance between vector and vector2. If these vectors represent positions in the 3D world, this is the distance between them. Floating-point value of distance. duplicate() A copy of the vector. A new vector object. Vector binary operations Use these syntaxes to perform additional vector math calculations: Operator Description Returns vector1 +vector2 Returns a new vector equaling vector1 +vector2 for x equaling 1 through 3.
Transform properties Use these properties to work with transforms: Property Access Description Default position Get and set Lingo vector object describing the position of vector (0,0,0) a transform with the value vector(xOffset, yOffset, zOffset). A model.transform position represents the model’s position in relation to its parent. scale Get and set rotation Get and set Lingo vector object describing the x, y, and z scale of the transform with the vector value vector(xScale, yScale, zScale).
Property Access Description Default y axis Get and set vector A vector representing the transform’s canonical y axis in transform space. Example: (0,1,0) transform.identity() transform.rotate(90,0,0) put transform.yaxis --vector(0,0,1) z axis Get and set vector A vector representing the transform’s canonical z axis in transform space. Example: (0,0,1) transform.identity() transform.rotate(0,90,0) put transform.
Command Description Returns translate (xIncrement,yIncre ment,zIncrement) Translates the position of the transform relative to the transform’s current orientation: 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 (100,0,0), 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 transforms. Useful for combining the effects of two transforms. A new transform object 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 3D cast None 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.
Use the following properties to work with 3D cast members in Lingo: 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. animation Enabled Get and set loop Get and set TRUE (1) or FALSE (0) specification of TRUE (1) whether animation, if any, will play.
Property Access Description 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. No texture percent Streamed Get Percentage of file that has been downloaded, with values from 0 to 100. None bytes Streamed Get Integer number of bytes that have been downloaded, with values from 0 to the size of the file in bytes.
Property Access Description Default targetFrame Rate Get and set Controls the desired playback speed. If the useTargetFramerate property is TRUE (1), then the lod.bias property of all model resources is dynamically altered until the target frame rate is met. 30 useTarget FrameRate Get and set If a target frame rate has been set and you want to use it, set this property to TRUE (1).
Chapter 20
CHAPTER 21 Movies in a Window Macromedia Director MX 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.
Creating a MIAW using Lingo In Lingo, you create a MIAW by specifying a window’s rectangle (rect property) on the Stage and then specifying the filename for the movie that is assigned to the window. You can also make the window visible, change its type, set its title, and set the window’s size and location. The easiest way to create a MIAW is to open a window for an existing movie.
Opening a MIAW Before you can play a movie in a separate window, you must open the window explicitly with Lingo. To open a MIAW: • Use the open window command. Unless Lingo explicitly preloads the movie, 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 command. You can specify other window characteristics before or after you open the window.
To specify the window type for a MIAW: • Assign a value for the windowType property. Different numerical values for the windowType property specify different types of window styles. When you don’t specify a window type, Director uses a movable, sizable window without a zoom box and with a title bar, which is type -1. You can set the title property only for windows of type -1. In most cases, it’s best to specify window settings before you open the window to avoid delays as the window redraws.
To scale a MIAW: • Set the drawRect property to coordinates that are smaller than the MIAW’s original size and apply the position to the window, as shown in the following example: set aRect = [0, 0, 200, 300] set window("Sample").drawRect = aRect -- sets window size to 200 x 300 set window("Sample").
Controlling interaction between MIAWs Movies can interact with each other by sending Lingo messages back and forth. This lets movies share current values for variables, share information about current conditions, and send each other Lingo instructions. Global variables can be declared in the main movie (the Stage) or in a MIAW. No matter where they are declared, they are available to the main movie and to all movies that are playing in windows.
CHAPTER 22 Using the XML Parser Xtra The XML Parser Xtra lets Macromedia Director MX 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 convert the contents to a Lingo list that is meaningful to you and your movie.
Using XML parser objects The XML Parser Xtra lets Director developers access the nodes of an XML document. A node can be a tag (similar to an HTML tag, also called an element), character data (text that does not appear inside the angle brackets of a tag), or a processing instruction (a special type of tag that passes data to the parsing application for special processing). You can extract information from the XML document by looking at its nodes with Lingo.
The following Lingo statement uses the makeList() command to convert the parsed data to a property list: theList = gParserObject.makeList() If you choose to make a property list with the makeList() command, the result is a nested property list, reflecting the tree structure of the XML. Each element in the document is represented by its own property list, with another property list for each child element that it contains.
You use Lingo to access the nodes of an XML document.
The gParserObject variable contains the parsed XML. When used in the preceding Lingo, it refers to the root node of the XML document. The Lingo term child[1] refers to the first level of nested tag, which is the e1 tag. To find out what kind of node the first tag is, use the type function, as shown in the following example: put gParserObject.child[1].type -- #element To refer to nodes that are nested more than one level deep, use more than one level of child reference.
Accessing attributes Some XML tags contain attributes with values. Use the Lingo attributeName and attributeValue properties to access the attributes of tags that have values. In the previous XML example, the first tag nested inside the e1 tag is called tagName and has two attributes called attr1 and attr2. The following Lingo uses the attributeName property to return the name of the first attribute of the tag called tagName, which is the first child of the e1 tag: put gParserObject.child[1].child[1].
Treating white space The default behavior of the XML Parser Xtra is to ignore character data between XML tags when all the characters are white space. This type of white space is usually due to Return characters and superfluous space characters, but sometimes it can have meaning to the XML document. You can use the ignoreWhiteSpace() function to change the way the Xtra treats white space.
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. It does not match the character set used in most Western versions of the Mac OS (MacRoman) and does not match character sets commonly used in most non-Western countries. The first 127 characters (binary codes 1-127) are the same in most countries.
CHAPTER 23 Making Director Movies Accessible As a Macromedia Director MX 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 Lingo and behaviors, you can add text-to-speech capability to your movies.
Using the Speech Xtra The Speech Xtra adds special commands to Lingo that enable the Director text-to-speech capability. The text-to-speech behaviors require this Xtra because they use these Lingo commands. If you write custom text-to-speech Lingo scripts, you need to include the Speech Xtra in your movie’s Xtra list. Keyboard navigation does not require the Speech Xtra. The Speech Xtra supports Microsoft SAPI 4 and 5.1 on Windows. The Xtra supports all versions of text-to-speech on the Macintosh.
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.
3 You can specify a Lingo string to be executed when the user presses Enter (Windows) or Return (Macintosh) while the sprite is selected. You can use any valid Lingo string, such as a go to frame 20 command or a call to a separate handler that you have written, such as startAnimation. 4 Click OK 5 Repeat this process for each sprite in the scene that you want to be navigable.
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 553. 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.
To apply the Accessibility Speak Enable/Disable behavior: 1 Apply the keyboard navigation behaviors to sprites in your scene. For more information, see “Enabling keyboard navigation” on page 553. 2 Drag the Accessibility Speak Enable/Disable behavior from Library palette to the sprite you want to use to toggle the text-to-speech behaviors. 3 In the dialog box that appears, enter the behavior group name for the scene so that this behavior is associated with the other behaviors in the scene.
To apply the Accessibility Sync Caption behavior: 1 Apply the keyboard navigation behaviors to sprites in your scene. For more information, see “Enabling keyboard navigation” on page 553. 2 Apply the text-to-speech behaviors to sprites in your scene. For more information, see “Enabling text-to-speech” on page 555. 3 Drag the Accessibility Sync Caption behavior from the Library palette to the sprite that will trigger the text-to-speech feature.
Using accessibility Lingo If you have a basic understanding of Lingo, you can write custom scripts to add text-to-speech functionality to your movies. For more information about Lingo, see Chapter 16, “Writing Scripts with Lingo,” on page 385. First, you must initialize the speech software. To initialize the text-to-speech software: • Use the voiceInitialize() command. The following frame script tests whether text-to-speech software is installed.
To check whether the speech is currently speaking, paused, or stopped: • Use the voiceState() function. To set the volume of the voice: • Use the voiceSetVolume() command. To set the pitch of the voice: • Use the voiceSetPitch() command. To determine the chronological number of the current word within the string being spoken: • Use the voiceWordPos() function. The following frame script tests whether the current voice is female and starts speech if it is.
To add the Speech Xtra to the movie’s Xtra 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 Select the Speech Xtra from the list. 5 Click OK. The Add Xtras dialog box closes. 6 Click OK again. The movie Xtras dialog box closes. 7 Save your movie. System requirements Windows computers must have Microsoft Speech Application Programming Interface (SAPI) 4.0 or later installed. SAPI 5 is recommended.
Chapter 23
CHAPTER 24 Managing Memory Macromedia Director MX 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.
Whenever Director runs low on memory, such as when trying to load many large cast members, other cast members are automatically unloaded from memory, according to the following rules: • The first cast members to be unloaded are those that have a purgePriority value of 3. This type of discarding is fast but is essentially random, which means you cannot predict which of these cast members will be unloaded at any given time.
Preloading digital video It is recommended that you do not preload digital video cast members. Digital video is played by streaming the video file from a disk. As the file is streamed, it is decompressed into memory one section at a time. Preloading a digital video file causes the entire file to be decompressed into memory at once, which can cause low memory situations on most computers.
Chapter 24
CHAPTER 25 Managing and Testing Director Projects As you work with Macromedia Director MX 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.
Testing often during development Testing should be an integral part of your Director development process. You should test the functionality of each small part of your movie as you add it rather than waiting until the movie’s whole feature set is implemented. When you build features that are interdependent, you should test each one before adding the next. If you test this way, you’ll know that the most recently implemented feature is the most likely source of the problem.
Resources The following resources are available to help you with testing and troubleshooting your Director movies: • Chapter 16, “Writing Scripts with Lingo,” on page 385 contains extensive information about debugging Lingo scripts. • Index of Director testing and troubleshooting TechNotes, at www.macromedia.com/support/ director/troubleshoot.html • TechNote 13872, General troubleshooting tips, at www.macromedia.com/support/general/ts/ documents/troubleshooting_pt87.
CHAPTER 26 Packaging Movies for Distribution When you finish authoring your Macromedia Director MX movie, you have a choice of several ways to prepare it for distribution. You can distribute a movie in the Shockwave format that plays in a browser or as a stand-alone projector. Stand-alone projectors can contain the software necessary to play the movie, or they can use an installed Shockwave player to play the movie independently of a browser. You can also export a movie as a digital video.
Previewing a movie in a browser You can preview a movie in a browser on your local computer to view JPEG-compressed bitmaps, and to check the movie design, Lingo, and any other performance issues related to playing a movie in a browser. Previewing a movie creates temporary Shockwave (DCR) and HTML files that open in a browser. Note: When you use the Publish command rather than the Preview in Browser command, you can create permanent DCR and HTML files that let you view the movie in a browser.
The Shockwave player includes the Xtra extensions that support the most common features and media types. These include text; vector shapes; Macromedia Flash; BMP, PICT, JPEG, and GIF file importing; sound management; and Shockwave Audio. Xtra extensions not included with the Shockwave player must be installed in a user’s system before the movie plays. Use the Download If Needed option in the Movie Xtras dialog box to make the movie prompt the user to download the Xtra extension.
Managing Xtra extensions for distributed movies You can manage Xtra extensions for your movie using the Modify menu. To manage Xtra extensions for the current movie: 1 Select Modify > Movie > Xtras. 2 To add or remove Xtra extensions, do any of the following: • To add the Xtra extensions required to connect a projector to the Internet, click Add Network. • To restore the list of default Xtra extensions, click Add Defaults.
• A projector is a movie intended for play outside of a web browser. A projector can include a player (called the Standard player), Xtra extensions, multiple casts, and linked media in a single file. A projector can also include several different movie files. Configured in this way, a projector can be a completely stand-alone application. You can use the Shockwave player projector option to make a much smaller projector.
Creating Shockwave movies You save your work as a Shockwave (DCR) movie to prepare it for playback in a Shockwaveenabled web browser, or to make disk-based movies smaller. Using a Shockwave movie also prevents your users from editing the movie if they own Director.
Changing Publish settings You can change Publish settings by using the Publish Settings dialog box. To change Publish settings: • Select File > Publish Settings. The Publish Settings dialog box appears with some or all of the following tabs, depending on the HTML template you select: Formats, General, Shockwave, Compression, Shockwave Save, and Image. The Image tab, for example, appears only if you select the Shockwave with Image HTML template.
To use the General tab: • To make the DCR movie match the dimensions of your DIR movie, select Match Movie in the Dimensions field. • If you use the default Match Movie setting in the Dimensions field, values in the OBJECT and EMBED 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.
• To determine how your movie will line up within the OBJECT or EMBED values in the HTML file, use the Stretch Position Horizontal Align and Vertical Align options. For more information about using stretch styles, see the procedure under “Setting movie options for browser resizing” on page 580. • To change the background color that displays while your DCR file is downloading, either click the Background Color box and select a color, or enter a value in the hexadecimal field.
• The Package File field lets you enter a fully qualified or relative URL to a package text file. This text file, in XML, provides a list of URLs with support files to download for a complete save of the current project. • To specify the size, in bytes, of all content with packages that needs to download for the movie to save successfully, use the Total File Size field.
• To maintain the same aspect ratio of your original Director movie no matter what size the user makes the browser, select Preserve Proportions. The movie will fit within the width and height parameters, as much as possible, while preserving the movie’s aspect ratio. The movie aligns within the window based on the align tags that you specify in step 4. • To change the size of the movie to fit the size of the browser, select Stretch to Fill.
4 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. About projectors To create projectors for any version of Windows, you must use the Windows version of Director; likewise, you can create Macintosh projectors only with the Macintosh version of Director.
5 To control how movies interact with the user’s system, select Playback options: Play Every Movie specifies that the projector play all movies in the play list. Otherwise, the projector plays only the first movie in the play list (unless other movies are called by Lingo from the first movie). In a projector with Play Every Movie selected, pressing Control+period (Windows) or Command+period (Macintosh) branches to the next movie, and Control+Q (Windows) or Command+Q (Macintosh) quits.
9 To determine how the player code is included in the projector, select an option for Player. Standard includes the uncompressed player code in the projector file. This option starts the movie faster than other options but creates the largest projector file. Compressed includes a compressed version of the player code in the projector file. This substantially reduces the projector file size, but decompressing the player code adds a few seconds to the startup time of a movie.
12 In your Director application folder, copy the Xtra extensions required to play your movie into the Xtras folder you just created. You must also include external movies, external casts, and linked media with your projector. If the external files are in the folder that contains the projector, the projector can automatically link to the files. 13 (Windows only) In your Director application folder, copy the files dirapi.dll, iml32.dll, proj.dll, and msvcrt.dll into the Xtras folder.
4 Click OK. A dialog box appears from which you select the files to change. 5 Select the movies and casts you want to change and click one of the following: • Click Add to add the selected files. • Click Add All to add all the movies in the current folder. The items you select appear in the file list at the bottom of the dialog box. You can update movies in different folders at the same time.
2 Select the range of frames you want from the Export options at the top of the dialog box: Current Frame exports the current frame on the Stage. This is the default. Selected Frames All Frames exports the selected frames in the Score. exports all frames. exports only the range of frames that begin and end with the frame numbers you enter in the Begin and End boxes. Frame Range 3 If you select Selected Frames, All Frames, or Frame Range as the Export option, select one of the following options.
Setting QuickTime export options You use the QuickTime Options dialog box to specify options for exporting a movie as a QuickTime digital video. This dialog box appears when you click the Options button in the Export dialog box and QuickTime is the specified format. To set QuickTime export options: 1 Select File > Export. 2 Select QuickTime Movie from the Format pop-up menu. 3 Click Options.
5 To reduce the file size of a QuickTime movie at the expense of quality, select an option from the Compressor pop-up menu. Different options appear on the Compressor pop-up menu depending on the video hardware and software available in your system. Consult your QuickTime documentation. Animation Cinepak compression is for simple animations. compresses 16-bit and 24-bit video for playback from CD-ROMs. Component Video Graphics None compression is for exporting single frames of computer graphics.
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. Also, movies are easier to edit if they are organized in discrete sections. The best way to organize a large production is to create a small projector file that launches the movie and then branches to Shockwave or protected movies.
CHAPTER 27 Using Shockwave Player Macromedia Director MX 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.
If the movie jumps ahead in the Score or uses cast members that are referenced only by Lingo scripts, the required cast member might not be available when necessary. If cast members are not available, the movie either ignores them or displays a placeholder, depending on how you set the streaming options in the Movie Playback Properties dialog box. A challenge of authoring for Internet streaming is ensuring that all cast members have been downloaded by the time the movie needs them.
You can specify streaming options any time before saving a movie as a Shockwave movie. Note: If you want to test how a movie will stream from a server before you save the movie as a Shockwave movie, use File > Save and Compact to make sure the data in the movie is properly ordered and that redundant data is removed. To set movie playback options: 1 Select Modify > Movie > Playback to define streaming options. 2 To stop the movie from streaming, deselect Play While Downloading Movie.
To set Shockwave playback options: 1 Select File > Publish Settings. The Publish Settings dialog box appears. 2 On the Shockwave tab, select the options that you want to provide for your users, as described in the following list: Volume Control lets users adjust the volume of the movie’s soundtrack. Transport Control provides controls for rewinding, stopping, and stepping through the movie in Shockmachine. determines if Shockwave stretching is allowed.
Looping behaviors Looping behaviors make the playhead return (loop) to a frame or stay on the current frame until specified media elements have been downloaded and then continue to the next frame. Attach a looping behavior to a frame in the script channel, not to a sprite.
Checking whether a frame’s contents are loaded Use the frameReady() function to determine whether all the media elements that the specified frame requires are available locally. See frameReady() in the Lingo Dictionary. Downloading files from the Internet with Lingo Lingo uses the Internet’s resources by obtaining files from the Internet. The data is copied to the local disk or cache. After data is available on the local computer, use Lingo to retrieve the data for the movie.
To retrieve a file as text: 1 Use the getNetText() function or the postNetText command to start retrieving text. See getNetText() or postNetText in the Lingo Dictionary. 2 Use the netTextResult() function to return the text you retrieved with getNetText or postNetText. See netTextResult() in the Lingo Dictionary. To retrieve and play a new Shockwave movie from the network: • Use the gotoNetMovie command. See gotoNetMovie in the Lingo Dictionary.
To obtain the MIME type of the HTTP item: • Use the netMIME() function. See netMIME() in the Lingo Dictionary. To conserve memory, Director discards the results of the netTextResult(), netDone(), and netLastModDate() functions within a short time after the operation completes successfully. netError(), netMIME(), • For netTextResult(), Director discards the results when the next operation starts. • For the other functions, Director retains the results through seven subsequent network operations.
Using URLs with Lingo In addition to the Lingo that is explicitly intended for use with network operations, some Lingo elements can use URLs as references to external files. The following Lingo elements can use URLs as file references in all circumstances: • • • moviePath pathName unloadMovie The following Lingo supports URLs as references to external files.
Lingo that is unsupported in browsers The following Lingo features are unsupported for movies that play back in browsers: • Creating and managing a MIAW • Installing and managing custom menus Interacting with browsers Lingo lets you write and read a preferences file within the dswmedia folder and display a string in a browser’s status area. To write to a preferences file on a local disk: • Use the setPref command. See setPref in the Lingo Dictionary.
Testing your movie However you select to create your movie, test it thoroughly before releasing it to the public. Make sure you test on systems with all common types of Internet connections, especially on slow modems and at busy times of day.
Chapter 27
INDEX Symbols & operator 291 && operator 291 ¬ (continuation symbol) 414 Numerics 2D text, converting to 3D text 455 3D cast members 455.
animated cursors creating 382 using 381 animated GIFs 205 tempo 205 animation animated color cursors 381 Cast to Time command 195 defined 185 exchanging cast members 193 film loops 197 frame-by-frame 193 launching 468 looping 449 motions, about 454 multiple sprites 196 onion skinning 234 Paste Relative command 201 playback 447, 449 real-time recording 200 step recording 199 using multiple cast members 195 with Lingo 201 animation modifiers.
bitmaps animated GIFs 205 Auto Filter command 233 changing color palettes and color depth 220 changing selected areas 214 compared to vector shapes 204 compressing 579 controlling with Lingo 222 exporting frames as 586 filters for 232 fonts 274 image options 150 image resolution 204 importing 204 onion skinning 234 resizing 220 shortcuts for changing 214 texture and 464 tiling 229 tweenable filters 233 Blend ink 183 Score display option 166 blending sprites 180, 188 blending window 505, 508 bones motions 50
cast members (continued) editing script of 134 editing text 276 finding 144 Flash 294 formatting text in 280 formatting text with Lingo 289 icons 138 ID displayed in Cast window 141 importing 146 importing text 276 in streaming movies 595 launching editors of 144 loading into memory 142 moving 139 naming 136 naming in Lingo 406 numbering in Lingo 406 organizing 139 Preload option 142 selecting 135 shapes 253 showing script in Cast window 141 sorting 139 text 275 tracing 217, 235 unloading 152 viewing proper
color (continued) choosing 257 choosing color palettes 259 color menu 257, 259 color picker 257 diffuse 449 favorite colors 258 of sprites 179 overview RGB and index 255 selecting how movie assigns 28 specular 449 tweening 188 color depth changing during import 150, 204 changing for bitmaps 220 changing for movies 256 description of color effects 217 color palettes changing colors in 261, 264 changing during import 150 changing for bitmaps 220 changing while authoring 259 changing while importing 204 channe
cropping movie in a window 540 videos 339 cross-platform issues.
Ellipse tool 247 ellipses, drawing 247 embedded fonts 274 empty lists 399 Enable Edit Shortcuts option 28 end frame 163, 173 engraver shader 494 Enter Frame event 364 Entire Sprite option 158 Eraser tool (Paint window) 207 events and actions, included 363 events, Behavior inspector Enter Frame 364 Exit Frame 364 Key Down 364 Key Up 364 Mouse Down 363 Mouse Enter 364 Mouse Leave 364 Mouse Up 363 Mouse Within 364 Prepare Frame 364 Right Mouse Down 364 Right Mouse Up 364 events, definition of 389 Every frame s
Flip command 163 flipping Flash movies with Lingo 298 sprites 178 floating-point numbers 405 flow of Lingo scripts 386, 410 Fontmap.
grid 169 aligning sprites to 170 configuring 171 groups (3D) 454 commands 462 overview 471 guides 169 adding and configuring 170 aligning sprites to 170 H half cylinders. See cylinders half spheres.
internal sounds compressing 326 using 320 Internet connection settings 47 digital video and 340 distributing movies on 575 See Also network operations Invert colors (paint window) 218 Invert Selection button 263 J joining sprites 174 JPEG files compressing 579 importing 204 K kerning 278, 287 about 281 with Lingo 289 Key Down event 364 key function 380 Key Up event 364 keyboard characters, testing for 408 keyboard shortcuts 17 keyCode function 380 keyframe motions 510 Keyframe player 454, 503 commands 507
linked media 149 linked movie cast member properties 314 linking external casts 153 List view, in Property inspector 448 lists adding items to 401 checking contents 400 copying 401 creating 399 definition of 390 disposing of 401 empty 399 linear and property 398 setting and retrieving items 399 sorting 401 syntax 398 using 398 literal values cast members and casts 406 decimal and floating-point numbers 405 description of 404 frames and movies 406 integers 405 strings 405 Load Font Map option 28 local action
messages (continued) order of 395 order of locations sent to 397 to sprite scripts 369, 370 when Lingo responds 397 methods, displaying for an Xtra 414 MIAW.
N O naming cast members 136 navigation creating basic controls 374 jumping and coming back 376 jumping to different locations 375 jumping to URL 376 markers 42 overview 373 using go command 375 NetConnection object (ActionScript) 309 netDone function 596 netError function 596 netID, setting 596 netLastModDate function 597 netMime function 598 netStatus function 600 NetStream object (ActionScript) 309 netTextResult function 597 Network obtaining data from 596 network operations adapting Lingo for 598 cance
painter shader 493 Palette Cast Member Properties dialog box 266 palette index color 255 specifying 28 palette transition 260 palettes.
properties actorList 422, 423 cast member 142 constraint 378 definition of 390, 398 height 176 loc of sprite 172 locH 172 locH of sprite 172 mouseV 380 percentPlayed 327 quad 176 rect 176 setting 402 soundChannel 327 sprite 164 state 328 streaming 593 width 176 Property inspector 444, 448 3D Extruder tab 463 basics of 24 information not appearing in 25 Member option 464 Text tab 462 using expander arrow to show/hide contents 25 property lists, creating 399 property variables, declaring 419 protected movies
Reset Rotation and Skew command 178 Reset World button 447 resizing sprites 175 resolution for screen images 204 Restore Cursor action 364 return function 397 Reverse ink 183 RGB color 255 specifying 28 Right Mouse Down event 364 Right Mouse Up event 364 rollOver function 379 rollovers 469 responding with Lingo 379 Roman Characters 274 root bone 505 Root Lock button 447 Rotate angle 163 Rotate button 447 Rotate button (Paint window) 215 rotating and skewing Flash movies with Lingo 298 rotating sprites 176 r
scripts (continued) inserting Lingo from menu 413 making decisions 410 objects 521 overview 385 parent. See parent scripts planning and debugging possible content of 397 removing 388 tools for writing 412 types of 385 writing 412, 426 See also Lingo scripts of cast members 397 Cast window icon for 386 description of 386 opening 389 scroll bar, displaying on Stage 286 scrolling text with Lingo 290 SDS.
sound (continued) issues for Windows 323 looping 322 playing during a transition 271 playing external 323, 327 repeating 322 Shockwave Audio 325 stops during a transition 271 streaming external 320 streaming with Shockwave for Audio 325 synchronizing with cue points 328, 341 synchronizing with Lingo 329 soundChannel property 327 SoundEdit 16, creating cue points with 328 Space to Time command 196 spaces in Lingo 391 spacing between lines.
Stage Selection sprite preference 158 Stage Size option 27 Stage Size projector options 583 Standard Import option 147 not supported for AVI and Quicktime files 147 start frame 163, 173 state of member property 328 statements calling 394 definition of 390 order run in 386, 410 Step Into button, uses for 439 step recording 199 Step Script button, uses for 439 Storyboard Format 49 streaming 449 controlling with Lingo 595 external sounds 326 flash movies with Lingo 300 making movies for 591 MP3 audio 326 optio
Text inspector 280 text ruler units 46 Text tab (Property inspector) 462 Text tool in Paint window 207 in Tool palette 253 Text window 275 text wrapping, setting with Lingo 289 text-to-speech 555 texture and text 464 clamping 493 commands 459, 495 coordinates 477 defined 454, 494 properties 495 texture mapping 477 texture object and shader layers 489 thumbnails appearing fuzzy in Cast window 141 creating custom 138 setting number of in Cast window 141 setting of in Cast window 141 tiles, custom 229 timeout
U unlinking external casts 153 unlocking sprites 167 Update Movies command 45, 585 updating movies from older versions 45 uppercase letters, using in Lingo 391, 405 URLs as references in Lingo 599 maximum length 149 navigating to 376 Use Movie Settings option 46 Use System Temporary Memory option 46 user interaction 373 verbose syntax in Lingo 392 Verisign Xtra downloading 573 vertex defined 245 selecting 247 vertices in mesh 477, 478 of box 476 of plane 477 Video for Windows (AVI).
X XML 543 Xtra extensions 3D 446 Auto Filter command 233 bitmap filters 232 cast member 50 description of 50 displaying list of 414 displaying methods 414 download properties 572 Filter Bitmap command 232 importing 50 installing 51 managing for distributed movies 572 scripting 50 tool 51 transition 51, 270, 271 viewing properties 142, 143 Xtras Cast Member Properties dialog box 155 Z z-axis and camera movement 469 and model movement 486 zero point, moving for paint rulers 213 Zoom pop-up menu in Score 33