Chapter 5

Limitations of Shockwave and the Web


CONTENTS

We've already talked about limitations due to size and download time, so let's talk about other types of limitations you will need to consider as you create your Shockwave movies. Actually, most things you can do in Director carry over to Shockwave, but there are a few things to keep in mind. This chapter covers the following:

External Files

The simplest form of a Director (or Shockwave) movie uses only one file. Everything needed is included in that one movie file. However, more complex movies may use external files in addition to the .DIR or .DCR file. Special consideration must be made for external files used by the movie or used by the Shockwave driver.

Linked Media

Linked media is like a cast member that is stored externally instead of within the movie. It can be a sound, video clip, or just about anything that you don't want stored within the Director movie. Director 5 even allows entire casts to be loaded as an external file. The movie would simply contain a reference to the name of the file, which would be retrieved and used as needed.

To use linked media, it needs to be downloaded ahead of time and stored on the end user's computer. The reason for this is the unreliability of transfer time on the Internet. If you have a sound or video file that you call from your Director movie, the user might end up waiting for an indeterminable period of time before it is ready. Any linked media files need to be already available in the same directory as the Shockwave plug-in.

Xobjects and Xtras

Xobjects are additions that Director users may use (or create) that allow Director to interact with external devices such as a CD-ROM or video card. They are separate files that the movie loads when it is played.

Xtras are new to Director 5. They are similar to Xobjects in that they may be developed by third parties to enhance the movie. Transition Xtras, Cast Member Xtras, and Lingo Xtras are three types of Xtras that may be used by the movie when it is played. See the Director manuals for more on using these.

Just like linked media, Xobjects and Xtras need to be on the viewer's computer in the plug-ins directory. Shockwave automatically looks in this directory, no matter what path is specified in your movie. For Xobjects, this ensures that the user intended it to be used, which prevents the risk of viewing a Shockwave file that might call hardware the user does not want it to call. Without this protection, a Shockwave movie could affect the user's hard disk or other devices without alerting the user.

Where to Put External Files

The directory for Xobjects and linked media is within the plug-ins directory of your browser. Shockwave will not look anywhere else for these files. Netscape Navigator's directory structure is used here as an example.

Tempo Controls

Another limitation is using the options in the tempo channel of the score in Director. Shockwave doesn't recognize commands from the tempo channel. A few simple Lingo scripts can accomplish the same tasks that may have been accomplished in the tempo channel.

Playback Rate

You can easily control the tempo using Lingo. To set the tempo to 30 frames per second, for example, use the following Lingo:

on startmovie puppetTempo 30 end

This could also be accomplished in a frame script, sprite script, or cast member script at any place throughout the movie.

Delays

To simulate a delay, you may use a loop. Note, however, that only one handler may execute at a time, so other activities may not occur concurrently. The following example delays for three seconds:

     on enterframe
          startTimer 
          repeat while the timer < 3 * 60
               nothing
          end repeat
     end

The "startTimer" command resets Director's timer to 0. The timer counts in clock ticks, which are 1/60 of a second. The "repeat while..." loop continues until the timer reaches 180 clock ticks (three seconds times 60 ticks per second). "nothing" is not a call to another handler; it's a Lingo term to do simply what it says.

If you want to delay for a few seconds, but maintain user interaction, set up two frame scripts. In the first frame, use the following script:

on exitframe
          startTimer 
     end

Then in the second frame, use:

on exitframe
if the timer <3*60 then go to the frame 
     end

The above method will loop in the second frame for three seconds, but will allow user interaction if you have buttons on the stage.

Wait for a Mouse Click or Key Press

To wait for a mouse click or key press, put a few simple handlers in the script channel of the frame you want to pause in. The first of these three handlers loops the playback head in the frame. The second two handlers respond to either a mouse click or key press to move into the next frame. Note that all three handlers are placed within the one frame script.

     on exitframe
          go to the frame
     end

     on mousedown
          go to the frame + 1
     end

     on keydown
          go to the frame + 1
     end

Director Features that Have Been Disabled

To protect the end user, Macromedia has disabled certain features of Director that could potentially be damaging or at least annoying to the viewer. Basically, anything that modifies or calls any of the hardware in the user's computer (hard disk, printer, and so on) has been disabled. This is different from Xobjects in that the commands are built into Director, not called from an external module.

You might think this is limiting your power as the movie creator, but the functions have been disabled for security purposes. You might be an honest Shockwave developer who uses the commands for good purposes, but there could be people who try to write or erase files, turn off the computer, print something, or perform other actions that the user did not agree to.

The following list (see table 5.1) was taken directly from Macromedia's Shockwave developer's information on their Web site. Most of these commands deal with reading and writing external files, running a movie in-a-window, or controlling the system resources. Limited file reading and writing can be done, though only within the Shockwave plug-in directory. See Chapter 14, "Further Use of Internet Lingo," for more on how to do this.

Table 5.1  Director Features Disabled for Shockwave

Feature DisabledDescription
openResFile, closeResFileControls resource files located outside of the movie
open window, close windowDirector movie in a window feature
importFileIntoReplaces file member with an external file
saveMovieSaves the movie to a file
printFromPrints whatever is displayed on the stage
open, openDA, closeDALaunches and closes specified applications
quit, restart, shutdownExits the movie, restarts or shuts down the computer
fileName of castLink to external files, paths, and so on
fileName of windowLink to external files, paths, and so on
getNthFileNameInFolderLink to external files, paths, and so on
moviePathLink to external files, paths, and so on
pathNameLink to external files, paths, and so on
searchCurrentFolderLink to external files, paths, and so on
searchPathsLink to external files, paths, and so on
mciPasses strings to Windows media controller

From Here...

Well, the limitations are out of the way. You now know what you can and can't do. It's time to start creating! The next three sections take you through the process: