Chapter 29

Shockwave and Lingo

by Richard Wainess


What Is Shockwave?

If you've ever heard of Shockwave, you probably think it's a powerful tool for creating interactive multimedia for the Internet or intranets (intranets are private networks that use Internet and WWW standards). Well, you're wrong. First of all, Shockwave is not a development tool; it's a runtime routine. Second, there are three different Shockwaves. Two are runtime routines for multimedia applications. (Actually, one is for a multimedia application, and one is for a computer-based training, or CBT, application.) The third version is for a graphics package. Confusing? Don't worry; the situation is not as complicated as it sounds.

At the time of this writing, Shockwave Audio Streaming and Shockwave for Xres were released.

When you hear the word Shockwave, think Shockwave and Afterburner. They go hand in hand. Afterburner is the application that works with the authoring and design applications to turn them into Internet-ready pieces. Shockwave is a browser plug-in that enables these applications to play on an Internet Web site or on an intranet. When I say "these applications," I'm referring specifically to three programs from Macromedia, Inc.: Macromedia Director, Macromedia Authorware, and Macromedia Freehand. Although Shockwave is not a development tool, it does enable the applications that have been shocked to include Web-related commands, such as the loading of HTML pages, and to become interactive tools for the World Wide Web.

What exactly are the three packages that can be shocked? Director is a multimedia authoring package, Authorware is a CBT authoring package, and Freehand is a vector-based draw package. Even though Freehand is, in its standard form, a static application, Afterburner for Freehand enables Freehand's vectored objects to contain hypertext links, turning them into hotspots capable of providing jumps to HTML documents.

Throughout this chapter, you will see the word currently quite often. Shockwave is a new technology and is rapidly improving and expanding. Each week Macromedia posts news on updates and changes to its Shockwave technology, including new Macromedia products capable of being shocked and new browsers capable of playing shocked applications. Visit Macromedia, Inc., regularly, at to stay current with Shockwave developments.

System Requirements

As with all applications, Shockwave and Afterburner have system requirements. Because Afterburner is an extension of the authoring package, if you own Director, Authorware, or Freehand, you have met Afterburner's system requirements. Of more concern are the system requirements for Shockwave (the browser plug-in).


Shockwave is an Internet browser plug-in that was developed by Macromedia to enable users to view and interact with Web-based multimedia files. Shockwave currently supports the following platforms:

For Director:Mac PPC and 68K; Windows 3.1 and 95
For Authorware:Mac PPC and 68K; Windows 3.1 and 95, NT 3.5.1
For Freehand:Mac PPC and 68K; Windows 3.1 and 95, NT 3.5.1

At the time this book was written, Shockwave plug-ins were available for Netscape 2.0 and 2.01, and for browsers compatible with Netscape plug-ins, and Microsoft's Internet Explorer 3.0 and Internet Starter Kit (Shockwave for ActiveX is also included in Microsoft's Windows 95 OEM Kit). However, plug-ins are currently in development for CompuServe's NetLauncher, America Online's Navisoft, and for Silicon Graphic's UNIX-based computers. Additionally, Netscape has chosen Shockwave as its de facto multimedia standard and will include the Shockwave code in all future Netscape browsers, alleviating the need for the plug-in.

Macromedia, Inc., at updates its compatibility list weekly.

Shockwave for Director (4.0x and 5)

Up until now, I have talked about Shockwave as a Netscape plug-in and Explorer ActiveX component for various Macromedia applications. Now, you'll examine each application and the power they bring to the Internet. I'll begin with Director.

Director is a powerful multimedia authoring tool. It has two components: a design package capable of creating sophisticated animations and an extremely powerful programming language, called Lingo. Lingo contains the core of Director's power and adds complex interactive and decision-making components to an already robust design tool.


After you create a Director movie, you must turn it into a shocked movie before it can play on the Internet. Afterburner is the Macromedia application that accomplishes this task. During the conversion process, Afterburner also compresses the Director movie (by an average of 60 percent, and often much more), which assists in keeping the file small. Afterburner is available on all current Macromedia platforms-Windows 3.1, Windows 95, Windows NT, Mac, and PowerPC.

Adding a Shocked Movie to an HTML Document

To add a shocked movie to an HTML document, you use an HTML EMBED tag. In its simplest form, the EMBED tag for a Director Shockwave movie looks something like the following:

<EMBED SRC="myMovie.dcr" WIDTH=320 HEIGHT=240 palette=background>

The EMBED tag comprises several components.


The tag begins with <EMBED SRC="??????".

The phrase SRC= refers to the source, or filename, of the shocked file to appear (that is, to be embedded) on the Web page. The filename (in quotes) follows the equal sign (for example, <EMBED SRC="MyDirectorFile.dcr").


Next come the WIDTH and HEIGHT tags, which refer to the actual pixel size of the files. ALL shocked files must include these two tags.


Director uses the PALETTE= tag, followed by either foreground or background (for example, PALETTE=foreground).

Foreground causes Director to load the movie's palette. The palette is then used for the whole Web page. This palette, of course, affects the colors of all elements on the page and must be planned carefully in order to achieve the expected result.

Background causes Director to ignore its internal palette(s) and to use the computer's system palette.

If you do not include the EMBED tag, Director uses PALETTE=foreground as the default.

If you do include the EMBED tag, PALETTE=background is the default.

As with all HTML tags, the EMBED tag ends with >.

Broken Icons

Unfortunately, the world is not a simple place, and neither is HTML programming. If everyone had a Shockwave-compatible browser and the Shockwave plug-in, the EMBED tag would be all that was needed in the HTML document. But many browsers, many versions of browsers, many platforms, and many operating systems are in use. If your browser does not support shocked files, you will see a broken icon on your Web page.


Fortunately, you can avoid broken icons simply by using JavaScript. Don't worry: You don't have to become a Java programmer to avoid broken icons. You will be given a simple template to follow. But before you look at the template, look a little more closely at the problem the template addresses.

HTML is a perceptive, or forgiving, language. Typically, languages either see something they understand, they display an error message, or they crash. Browsers, however, just ignore any HTML code they do not understand, and that behavior is the key to the EMBED tag.

When most browsers come across the EMBED tag, they have no idea what to do with it. Consequently, they ignore the tag, or at least they try. Unfortunately, some of the items within the EMBED tag can't be ignored-particularly the SRC tag. When a browser sees the SRC tag, it tries to display the object referenced. In the case of a Shockwave file, the browser tries to display the file. However, a browser that isn't familiar with the object type will display a broken icon in its place.

Netscape Navigator 1.1x has a different reaction to the EMBED tag. That browser recognizes the EMBED tag as an OLE link under Windows 3.1. However, the object does not conform to the expected model, so Navigator will display a broken icon.

Currently, the only browser that knows what to do with a shocked file is Netscape Navigator version 2.0. To that browser, the EMBED tag signifies that a plug-in (in this case, the Shockwave plug-in) will process the content within the tag. If you have the plug-in installed, you will see the shocked file. If not, you will see a broken icon.

Now comes JavaScript. JavaScript is a programming language that is built into Netscape Navigator 2.0. The key to JavaScript is HTML comment tags, <!--> and <-->. When all other browsers see the comment tags, they ignore anything within those tags. When Netscape 2.0 sees a comment tag that is prefaced by <SCRIPT LANGUAGE="JavaScript">, it will read the information inside the comment tags. The format for Shockwave files is


<!-- Information inside this comment area is only recognized by Navigator 2.0.

document.write( '<EMBED SRC="shockedfile" WIDTH=x HEIGHT=y>' );

<!-- This ends the hidden JavaScript from non-Navigator 2.0 Browsers -->


Replace the ( '<EMBED SRC="shockedfile" WIDTH=x HEIGHT=y>' ); as described earlier in this section.

You've almost taken care of the broken icon problem. Yes, you've eliminated the broken icons. For browsers that don't recognize JavaScript and don't have the Shockwave plug-in, what does the Web page display in place of the shocked file? With the preceding command, nothing, because you have not given HTML any display alternatives. Usually, when a graphic is to be displayed on a Web page, the SRC="graphic" command is followed by an ALT="text string" command. Because not all browsers are capable of displaying graphics or a particular graphic format, the ALT command enables you to display alternative text in place of the graphic, for browsers that don't understand the particular graphic format. Because JavaScript is hidden with a comment section, only browsers capable of reading JavaScript will see and display the shocked image. Fortunately, there is a solution to this problem.


Netscape Navigator ignores anything it encounters between the <NOEMBED> and </NOEMBED> tags. Other browsers, however, will read any tags within this area, which is where the solution to a missing alternate graphic exists.

By placing an alternative to the Shockwave file between the <NOEMBED> and </NOEMBED> tags, non-Navigator 2.0 browsers will display the alternative on the HTML document. The format is as follows:


<!-- Information inside this comment area is only recognized by Navigator 2.0.

document.write( '<EMBED SRC="shockedFile" WIDTH=x HEIGHT=y>' );

<!-- This ends the hidden JavaScript from non-Navigator 2.0 Browsers -->



<IMG SRC="alternativeFile" WIDTH=a HEIGHT=b>


Replace the ( '<EMBED SRC="shockedfile" WIDTH=x HEIGHT=y>' ); as described earlier.

Replace it with <IMG SRC="alternativeFileName" WIDTH=a HEIGHT=b>, using the width, height, and name of an alternative JPEG, GIF, or PNG image file.

Multiple Movies

Netscape enables you to include as many shocked movies as you wish on an HTML page. However, the way Director works with shocked movies is to place the entire movie into RAM before it can play. As you add more movies to a page, you need more RAM. Because pages might be accessed by computers with limited RAM, Macromedia recommends placing no more than three movies per page.

After the browser loads a new page, the Shockwave plug-in removes the previous movies from RAM. If you want to have numerous movies on your Web site, try to limit yourself to three movies per page and use as many pages as you need.

Multiple Movies Utilizing Sound

Sometimes Netscape has problems playing sound tracks (called sound channels) from two or more shocked movies at the same time. To avoid these problems, either include sound on just one movie on a page or require the user to trigger a sound from the movies with mouse clicks.


Although you can easily program a Director movie to loop constantly, this process can tie up the user's computer processor. I recommend that you include either an active Stop button or a counter in the shocked movie to limit the number of times the movie can loop.

Asynchronous Operations

Developers can create multimedia applications entirely, or almost entirely, using just the design and animation portion of the Director package. Typically, such an application supports little or no user interaction-for example, a simple animated fish tank. If you were developing a Web site for an aquarium company, you could use Director in this way to spice up a simple non-interactive site with a dynamic design element. Just create the animation and use Afterburner to turn it into a shocked movie. Fish will leisurely swim about the fish tank on the Web site.

Most developers, however, use Lingo to add control and interactivity to Director movies. Lingo, as Director's programming language, adds the capability of clicking buttons, branching choices, controlling animations, and much more. For example, you could use Lingo to enable viewers to select various fish (tropical, saltwater) or to view photos of various fish tanks. Lingo enables you to turn your Web sites into interactive experiences.

You can also use Lingo to incorporate Web-related commands into shocked movies. For example, viewers could click an Order button that would take them to a new HTML page where they could fill out an order form.

Although Lingo has over 200 commands, numerous additional Web-related commands-extensions-have been added to the Lingo language for creating shocked Web sites.

You can divide these extensions into asynchronous operations and functions.

Shockwave for Director versions 4.0x and 5 have a great deal in common. However, the Director 5 version offers additional commands and control. In the following section, I note Director 5-only commands and functions

getNetText uri

getNetText uri is the Lingo command that retrieves an HTTP text item for Lingo to read.

Although Lingo is not case-sensitive, protocol dictates starting all Lingo commands in lowercase and beginning all other words within a group command phrase in uppercase (for example, startMovie or mouseDown).

The URI portion of the command refers to the universal resource identifier. Universal resource locators (URLs) are a subcategory of URIs, as are file extensions.

An example of the getNetText uri command is

getNetText ""

The NetDone command determines if the getNetText command has finished.

gotoNetMovie uri

The gotoNetMovie uri command enables one Director movie to call, and be replaced by, another Director movie. The new shocked movie appears in the same place on the page as the first movie. When the command is called, the first movie continues to play until the second movie is fully loaded into RAM. Then, the first movie stops and is instantly replaced by the new movie.

The uri defines the location and name of the new movie.

An example of the gotoNetMovie command is

gotoNetMovie ""

If you issue a second gotoNetMovie command before the first new movie has finished loading, the second command cancels the first command and the second gotoNetMovie command will be accomplished. In other words, you can change your mind after selecting a new movie and select a different new movie instead

gotoNetPage uri, target

gotoNetPage uri is a Net-related Lingo extension that opens a new URI. The URI target does not have to be a Director movie. It can be another MIME type, such as an HTML page.

The target parameter is optional. It references a target frame if you have designed a page using the Netscape frame feature.

Only Director 5 shocked movies support the target parameter

preloadNetThing uri

The preloadNetThing uri Lingo command preloads an HTTP item into Netscape's disk cache so that you can access, or download, the item without any delays.

You need to keep a few things in mind when you use the preloadNetThing command. First, you have no way of knowing if the item has been removed from the disk cache. Also, you can load only one item at a time. If, for example, you want to load an HTML page containing a logo, two photos, and a shocked movie, you must load each item separately with its own preloadNetThing command.

An example of a preloadNetThing command is

preloadNetThing ""


Functions return a result based upon the preceding asynchronous commands. Macromedia added to Lingo a small group of functions that are specific to the Internet. They are referred to as net functions, and are identified by the inclusion of the letters net in their name.


If the asynchronous operation is complete, netDone() returns a result of TRUE. netDone() returns a result of FALSE if the operation has been started, but has not finished. The netDone() command defaults to TRUE.

An example of the netDone() function is

If netDone() then puppetSound "Trumpet"

The preceding example is the same as writing
If netDone() = TRUE then puppetSound "Trumpet"
netDone() and Netdone()=TRUE are equivalent.


netError() returns one of three results:


netTextResult()returns the result of the getNetText command. An example of this command is

If netDone() then

        put netTextResult() into field "Headline"

end if


netMime()returns the MIME type of an HTTP item. Only Director 5 shocked files support this function.


netLastModDate() returns the last modified date string located in the HTTP header for the item referenced. An example of this function is

put netLastModDate() into field "Page Updated On"

Only Director 5 shocked files support this command.


getLatestNetID() returns a unique identifier describing the last asynchronous operation started. This function is handy when using the netAbort command or the netDone() function.

Other Lingo Extensions

In addition to net-related asynchronous commands and functions, one other net-related command has been added to Lingo.


netAbort stops a Net operation that is in progress. Only Director 5 shocked movies support this command.

Director Commands Disabled for Shockwave

Although the good news is that additional Net-related commands were added for shocked movies, the bad news is that other Director commands have been disabled.

Although a variety of commands have been disabled, most of them relate to data transmission. The primary reasons for disabling commands are to prevent the transfer of viruses and to block the capability to read information off of a user's hard drive and transfer that information back through the shocked movie to a Web site. Lingo, like virtually all other programming languages, can read, write, and delete files. Therefore, if certain capabilities were not disabled, the shocked movies, via Lingo, would have access to users' hard drives, where they could extract information (upload local files, including both data and programs), delete information (delete local files and programs or entire drives), or introduce information (alter files, add files, add viruses).

The following commands have been disabled in Director 4.0x and Director 5 shocked movies.

Table 29.1 shows Director-related commands that open, close, paste, print, and save files.

Table 29.1. Disabled Director-related commands.

openResFileThis Mac-only command opens a specific resource file. Because shocked movies might be played in Windows or another operating system, this command has been disabled to prevent errors.
closeResFileThe counter command to the openResFile command closes a resource file that has been opened on a Mac. It has been disabled for the same reasons as the openResfile command.
open windowDirector has the capability of playing a second movie inside of an opened Director movie. You can size this "windowed" movie from very small to large enough to occupy the entire screen size of the current movie.
Because the Windows version of Shockwave currently has problems with Director windows, and because Netscape supports only Director windows if the EMBED command is used, this feature has been disabled. Macromedia is working to resolve this problem.
close windowThis command closes an open Director window, but because opening Director windows has been disabled, this command is also disabled.
importFileIntoCastmembers (the objects-graphics, scripts, videos, and so on) that are used in a Director movie are all referred to as castmembers. Most often, all castmembers are saved inside of the Director movie. The importFileInto command enables an external file to be loaded into a castmember position of a Director movie, either replacing one of the movie's castmembers or adding a new castmember to the movie. As already mentioned, to maintain system integrity, all I/O or data transfer functions have been disabled; importFileInto falls into this category and has been disabled.
saveMovieBecause the content of the movie might change while it is being played (from importfileInto commands, data entry, and so on), Director enables you to save movies that are playing-that is, to retain the changes. Again, this function is an I/O or data transmission function, so this command has been disabled.
printFromThe printFrom command enables the user to print a hard copy of the content of the stage, or what is being viewed by the user. This command has been disabled for two reasons. First, the user might not have a printer, or the printer might not be capable of printing graphical information. Second, some printer setups are designed to print to file, so the issue of I/O or data transmission occurs.
pasteFromClipboard member xThis command pastes the contents of the user's Clipboard into the castmember location specified by x. Director 5 adds castlib y to the end of the command, which enables the viewer to specify a castlibrary. As with all data transfer functions, this command has been disabled.

Table 29.2 shows system-related commands that are used to open and close programs.

Table 29.2. Disabled system-related commands.

openThis command is used to start, or launch, another application while the Director movie is playing. Because users might not have that particular application on their system or because they might not have enough RAM to run both applications, this feature has been disabled.
OpenDAThis Mac-only command opens a Mac desk accessory. (Windows ignores this command.)
Not all Macs have the same accessories, so this function has been disabled.
CloseDAAs the counterpart to the openDA command, closeDA has also been disabled.
QuitThis command exits Director. In Windows, quit returns you to Program Manager; in Windows 95, it returns you to the main interface. On the Mac, quit returns you to Finder. Because quit will also close your browser, it has been disabled for shocked movies.
RestartOn Macs, this command restarts the computer. This action is even more drastic than the quit command, so the reasons for disabling this command should also be obvious.
ShutDownAs with the quit and restart commands, this command has dramatic effects on the computer. On Macs, shutDown closes any applications that are open and then turns the computer off. In Windows, the shutDown command exits the Director movie (or Director, if in an authoring mode) and then exits Windows.

As already stated, all I/O or data transmission commands have been disabled. This includes all commands relating to filenames and file paths.

Table 29.3 shows filename commands that return or alter filenames. Path commands return or locate file paths or define what local folder paths are to be searched.

Table 29.3. Disabled path and filename commands.

fileName of castThis command changes the name of the externally linked file associated with a castmember.
fileName of WindowBecause Director does not currently support windows, this command, which defines the name of the Director movie to be placed into the window, is also disabled.
GetNthFileNameInFolderThis command returns the name of a file with a directory (Windows 3.x) or folder (Mac or Windows 95). The parameters of the command include a number that refers to the Nth file within that folder. This function has been disabled because it could enable a shocked movie to read filenames from a user's computer.
MoviePathThis disabled command returns the pathname of the folder or directory in which the current movie is located.
PathNameThis command is the same as the moviePath command.
SearchCurrentFolderThis flag command can be set either to TRUE or to FALSE. If TRUE, Director searches the movie's current folder first, before searching any other folders (see searchPaths).
SearchPathsThe searchPaths command defines the various paths that the Director movie may search in order to locate files.

Table 29.4 shows the MCI, a Windows-only feature that accesses Windows' media controller. Via the controller, media devices can be accessed and controlled by shocked movies. Although MCI is a single command, it has dozens of parameters for controlling the functions of various devices.

Table 29.4. Disabled MCI command.

mciIn a Windows environment, this command gives Director access to the Windows media controller and various media control functions, including recording sounds, triggering a video disk player, and playing music tracks on a CD-ROM. Because not all Windows systems are alike (for example, not everyone has a CD-ROM), this command has been disabled.

XObjects, XCMDs, XFCNs

XObjects, XCMDs, and XFCNs refer to external objects, commands, and functions. Although both Windows and Macs can use XObjects, only the Mac can use XCMDs and XFCNs.

XObjects enable third-party developers to create new features and enhancements for Director 4.0x. For example, Director 4.0x does not include database functions, but outside developers have used Xobjects to add this feature.

Macromedia added an entirely new function, called Xtras, to Director 5. Xtras technology enables third-party developers to create and distribute sophisticated add-ons to Director, including new transitions, database management, sophisticated printing capabilities, and new commands.

XObjects, XCMDs, and XFCNs can be either internal (included within a Director movie) or external (referenced or pointed to by a Director movie). Shocked movies support only external XObjects, XCMDs, and XFCNs.

In order for a movie to use external Xobjects, XCMDs, or XFCNs, these files must be located in the user's Plug-In directory. Users need to download the external files prior to using them in a shocked movie.

The purpose of this chapter is to introduce and explain Shockwave and programming as it applies to the Internet and intranets. Programming for Xobjects, XCMDs and XFCNs is beyond the scope or intention of this chapter. Please refer to the Director manuals for instructions on how to use these features.

Disabled Director 5 Commands

Director 5 added a new feature called multiple casts. Although Director 4.0x used only one internal cast, Director 5 can open and use multiple external casts. This function enables you to have different casts for different languages or to divide casts by object type (for example, a digital movie cast, a script cast, a text cast, a graphics cast).

In some cases, Shockwave has entirely disabled these multiple cast functions. In other cases, Shockwave has limited the function. More specifically, shocked movies cannot specify paths for locating cast libraries. Shocked movies can use only cast libraries located in the Plug-In directory. To use multiple casts, allow users to download the additional casts and place them in their Plug-In directory.

Previously, commands that were disabled for both Director 4.x and 5 were described. Table 29.5 shows commands disabled only for Director 5 Shockwave. In most cases, these commands are disabled by Director 5 but not by Director 4.x, because they are commands new to Director 5.

Table 29.5. Disabled Director 5 commands.

OpenXLibThis command can access cast libraries in any path by specifying the complete path and filename. Because shocked movies can use the Plug-In directory only for locating cast libraries, just specify the filename, not a complete path.
CloseXLibAs the counterpart to the OpenXLib command, follow the same restrictions as for the OpenXLib command.
opencastlib x importFileInto member x of castlib y This command is similar to the importFileInto command described earlier. The difference is that this command takes advantage of Director 5's multiple cast by enabling you to import a file type into both the movie's main, internal cast, and an external cast library. Because this is a data transmission function, this command has been disabled.
save castlibThis command enables Director to save cast libraries. Depending upon the parameters, Director either updates the original cast library or creates a new cast library.

Work Arounds for Other Director-Disabled Features

Director shocked movies do not support the score's tempo channel. The elements that appear on the screen (the stage) of a Director movie are placed onto Director's score. The score has spots (channels) for 48 items at any given moment. In addition to the 48 channels, known as sprite channels, Director has five other special channels: a script channel, two sound channels, a transition channel, a palette channel, and a tempo channel.

The tempo channel includes four features:

Although this situation might seem to be somewhat limiting, it is not. You can use Lingo to re-create all the functions of the tempo channel. As a matter of fact, using Lingo affords even greater control of the functions. For example, the tempo channel enables the movie to pause in increments of one second only, but you can define Lingo pauses in 1/60 of a second increments. Another example of additional control through Lingo is the wait for mouse click or key press feature. Through Lingo, you can specify the mouse, a key, or both; you can specify either the left or right mouse button or both; or you can specify a key combination (such as Shift+Alt+A) that the user must press to continue with the movie.

The following are examples of Lingo work arounds for the tempo channel functions.

Wait (Seconds)

In this example, the movie will wait three seconds.

on exitframe

    startTimer -- this resets the timer to zero

    repeat while the timer < 3 * 60  -- the 60 represents 60 ticks per second


    end repeat

    go to the frame


Mouse or Key Clicks

In the first example, the movie will wait for a mouse click, at which time it will advance to the next frame containing a marker.

on exitFrame

    go to the frame


on mouseDown

    go to next


A variation to the preceding scenario follows. Note that it uses only one handler instead of two.

on exitFrame

    if the mouseDown then

        go next


        go to the frame

    end if


In the next example, the movie waits for a mouse click or any key to be pressed. (Note the third variation of the mouseDown line in the exitFrame handler.)

on exitFrame

    if the mouseDown then go next

    go to the frame


on keyDown

    go to next


In the final example, the movie waits for the F key to be pressed or for the right mouse button to be pressed on a PC or the Control Key/Mouse button combination on a Mac. (This command works only in Director 5.)

on exitFrame

    if the rightMouseDown or (the key = "f") then next

    go to the frame


In order for the right mouse button feature to work, you must add the following phrase to the Director movie before you use the rightMouseDown command.
set the emulateMultiButtonMouse to TRUE
In a typical movie script, this phrase appears in the startMovie handler


You can use the puppetTempo command to change the tempo of a movie. The following example sets the movie's tempo to 30 fps when the movie begins playing.

on startMovie



Waiting for Sounds To Finish

Lingo uses the soundbusy(x) command to determine if a sound is still playing. Although the tempo channel can test only the two sound channels located in the score, the soundbusy(x) command can check all eight sound channels available to Director. The additional six channels can be activated only through the sound playfile command, but all eight are tested by the soundbusy(x) command. The following example tests the fourth sound channel and branches to a marker called "Menu" if the sound in sound channel 4 has finished.

on exitFrame

    if not soundbusy(4) then go to "Menu"

    go to the frame


Waiting for Digital Videos To Finish

The current version of Director does not support Quicktime or Video for Windows files because shocked files cannot use linked files (and in Director, digital video is always linked). Because Macromedia might remove this restriction in the future, take a look at how to test if a digital video has finished playing. This test requires two Lingo commands: the movieTime of sprite command and the duration of cast x command. Director measures the length of digital videos in ticks. Each tick represents 1/60 of a second. The duration of cast x command returns the length, in ticks, of a digital video. The movieTime of sprite command points to the current tick being played in a digital movie.

When the movietime of sprite command returns the same value as the duration of cast x command, the movie has finished playing. Here is an example of the command sequence:

if the movieTime of sprite 6 = the duration of cast "MyMovie" then

    go to the frame +

end if

Until Director can support digital video , you can use PICT sequences to achieve the illusion of digital video.

Director Bandwidth Issues

Director can create highly complex and very large movies, but you must be aware of the bandwidth restrictions of the Internet when you are developing shocked movies.

Although some people have the luxury of accessing the Internet through T1 or T3 lines, and many people have access to ISDN lines, most people are using 14.4 and 28.8 modems. And because these slower modems slow down the Internet in general, many T1 lines have the effective throughput of a 28.8 modem.

A 14.4 modem transfers information at about 1K (one kilobyte, or 1024 bytes) per second. At this speed a user would have to wait at least two minutes to download a 120K shocked movie. Remember, the movie will not begin playing until the entire movie downloads.

Table 29.6 shows some relative download times, based upon file size.

Table 29.6. Relative download times (in seconds).

Movie Size14.4Kbps 28.8Kbps64Kbps 1.5Mbps
50K5017 101.7
100K10034 203.4
500K500170 10017
1MB1,000340 20034
10MB10,0003,400 2,000340

Considering that most people have 14.4 and 28.8Kbps modems, you can see that 100K is about the largest file size you should create for a shocked movie-at least until technology catches up and bandwidth issues no longer exist.

You can use various techniques to keep files small, including tiling backgrounds; using 1- and 2-bit graphics whenever possible; limiting the number of cast members; using short 11KHz, 8-bit, mono sounds; and resizing images to make them as small as possible.

Another way of keeping file sizes small is to take advantage of the two ways in which Director 5 creates text: the text tool and the field tool (or the text window and the field window). The text you create with the text tool turns into bitmapped text when you create the shocked movie. Field text, on the other hand, remains as font descriptions (that is, TrueType fonts) even after the movie has been shocked. Because bitmapped fonts must describe every pixel that makes up the text, and field text uses only text descriptions, field text takes up much less room than bitmapped text. The advantage of using field text is smaller movie sizes, but this method also has a disadvantage.

If the computer that the movie is playing on does not have the particular font used to create the field text, the computer will provide a substitute font. The results can be very unpredictable. Also, in cross-platforming, font sizes vary for equivalent fonts. The PC Arial font is smaller than the Mac Helvetica font. The same is true for their equivalent Times fonts. If you decide to use field text, stick to basic fonts, such as Arial, Courier, Symbol, Times New Roman, and Wingdings on the Windows platform and Chicago, Courier, Helvetica, Symbol, and Times on the Mac platform. Also, be sure to allow for varying font sizes within your stage design and the width of field castmembers.

Shockwave for Authorware

Authorware is Macromedia's icon-based authoring package. Because of its inherent features, it is primarily used to develop CBT. Like Director, Authorware supports very sophisticated interactivity, including the use of clickable buttons or graphics (hotspots).

Currently, Shockwave works only with Authorware 3.5 and on Netscape 2.0 or 2.01.

Although Authorware shocked applications can be used either on the Internet or on intranets, Authorware is currently targeted primarily for use with intranets. (Intranets are private networks that use Internet and WWW standards.)

The Shockwave plug-in is available for Windows 3.1x, Windows 95, Windows NT, 68K Macs, and PowerPCs.


Like Director, Authorware uses the Afterburner tool to convert Authorware applications into shocked applications. Afterburner is available both for Windows and Mac.

Afterburner performs three functions:

  1. It compresses Authorware files and libraries.
  2. It divides the files into several segments.
  3. It creates one map file for locating each segment when needed. Map files are explained later.

The Mac version of Afterburner performs one additional function. It flattens external files so they can be downloaded properly from intranets to Mac computers.

The file segments, the map, and the flattened external files are assigned MIME types.

MIME type for the Authorware map.
MIME type for a file segment.
MIME type for a flattened external file.

Using Afterburner for Authorware

Afterburner for Authorware is more complex than Afterburner for Director, which only requires that you run Afterburner and select the Director file to be shocked.

  1. Package the Authorware application. This is accomplished by performing the following steps:
  2. Compress the application by performing the following steps:

    Authorware segment files have the extension .aas

  3. Wait for Authorware's Afterburner to compress and segment the Authorware application. It will create just one map file, along with one or more segments, depending on segment size and file size. In addition, Authorware's Afterburner automatically adds entries for external files (for external content and for external libraries) to the map file.

Authorware's Afterburner creates all files with lowercase names. Some systems (for example, UNIX) are case-sensitive. Be aware of any case changes when using case-sensitive HTTP servers.

Editing Map Files

If you need to change filenames in your map file or if your Authorware application uses Xtras or Xobjects, you will need to edit your map file. Currently, the Windows version of Afterburner for Authorware has a built-in map edit facility. Mac users will need to read the following explanation of how to edit Mac map files.

The Elements of a Map File

The map file consists of up to seven line types. The primary line types are


The first line of a map file, ver, provides the version of the map file.


The second line, get, provides the path to the map file's location on the server. If the map file is located in the same directory as the HTML document, the get line contains a period. You will need to change this entry if your map file is not in the same location as your HTML page or if you change its location.

If the map file is not located in the same directory as the HTML document, you can provide either an absolute path (the full path) or a relative path (a subdirectory or subdirectory path off the HTML document). For example, if the HTML document is c:\mysite\HTML and the Authorware application files are in c:\mysite\HTML\myapps, the absolute path is c:\mysite\HTML\myapps, while the relative path is myapps. The relative path starts at the location of the HTML document and adds only the subdirectories that point to the correct folder or directory.


The put line describes where on the user's computer external files will be downloaded. The default location is the Download directory or folder. The Authorware plug-in automatically creates this folder when the plug-in sees the line put DOWNLOAD in a map file. If you want to download files into other folders or directories, you must specify those locations. If they do not exit on the user's computer, the plug-in will create them.

set, lib, bin

The line types set, lib, and bin refer to the internal and external files that make up the Authorware application.


The seventh line type is a comment line, which begins with the number sign.

As mentioned at the beginning of the Authorware portion of this chapter, map files provide the name(s) and location(s) of file segments, libraries, and external files. The map tells the Shockwave for Authorware plug-in where to find the elements required to play the Authorware application and provides pointers to various files.

Note that Map files have the .aam extension.

Of the seven line types in map files, the line type you will most likely be editing is the bin line referencing external files. You might also need to edit the segment and library lines and add Xtras and drivers to the map file. Another very important reason for editing map files is cross-platforming. If you are developing an application to run on both Mac and Windows, by editing the map file, you can combine both the Mac and Windows maps into a single file.

Editing Map Files in Windows

When you are editing map files, three types of lines typically might be edited. They are external lines, library lines, and segment lines.

Editing Segment Lines

The segment line has five columns. Moving left to right, they are

If you are changing any of the line entries in the segment, you are most likely changing its filename.

To edit a segment line, just double-click on the line to open an edit window. The edit window contains three editable windows: a pull-down window for changing the line type, a pull-down window for changing the platform designation, and a window containing the filename. The starting byte and file size are listed in the edit panel, but are not changeable.

Make whatever changes you wish and close the window; that is, click OK to keep the changes or Cancel to abort the changes.

Editing Library Lines

Library lines have the following four columns:

As when you edit segment lines, the column you will most likely edit for library lines is the filename column (column 3).

And, as with the segment lines, to make changes to a map line, just double-click on the line to open an editing dialog box. This box consists of five editable fields. The top field equates to the first column and is a pull-down window for editing the line type. Moving down, the second field, which equates to the second column, is a pull-down window for specifying the platform for which this library has been created.

The third field is the filename as located on the server, and the fourth field is the filename as it will appear when downloaded to the local (or client) device.

The final field is a Preempt flag (either checked or unchecked). If checked, this flag forces the user's browser to download the file located on the HTTP server. If, for example, the user had previously downloaded the file, this flag would force the user to download the file again, instead of using the version located on his or her computer. This step would be useful if, for example, the file had been updated or changed entirely.

Make your changes and click OK.

Editing External Lines

The lines of a map file that refer to external content consist of four or five columns-the fifth column is optional.

To edit an external file line, double-click on the line to open an editing dialog box. This box consists of five editable sections. The first four refer to columns 1 through 4 and consist of one field each. The top field equates to the first column and is a pull-down window for editing the line type. Moving down, the second field, which equates to the second column, is a pull-down window for specifying the platform for which this library has been created.

The third field is the filename as located on the server, and the fourth field is the filename as it will be downloaded to the local (or client) device.

The next section is the flags section and consists of four check boxes that determine when or how a file is downloaded. The download options are described in Table 29.7.

Table 29.7. Download options.

PreemptIf checked, the map file will override any files that exist on the user's computer or CD-ROM and force the file to be downloaded from the HTTP server. This option is useful for updating external files on a client computer.
OnDemandBecause Authorware is an interactive application, a user might not want to access all elements within the application. Instead of downloading all external files, the user can save time and space by downloading only certain files. The OnDemand flag specifies that the user wants to download an external file only if it is needed to run a particular portion of the Authorware application.
RecycleBy default, external files are deleted when an Authorware application ends. To prevent a file from being deleted, check the Recycle box. This option is particularly useful for intranet applications in which a user might be regularly accessing an Authorware application (for example, an interactive employee manual). Once the user downloads the external file, it will remain on his or her computer for further use.
MacBinaryThis flag creates a flattened file with the extension .aab, which combines the data fork and resource fork of the file into a single MacBinary file, thereby preserving the Mac file creator and file type information required to ensure proper downloading of movies, Xtras, and XCMDs. Normally, HTTP does not transfer this information.
EmptyEmpty is the default state. By not checking any of the preceding four options, the column will remain empty. Empty downloads external files at the beginning of an Authorware application and deletes them from the user's computer when the user closes the application. For Internet applications, Empty is the desired condition. For intranets, this condition will cause unnecessary delays for regularly accessed applications.

Multiple flags are separated by commas, for example, macbinary, recycle.

The final section of the dialog box for editing external lines is the Creator/Type section and consists of two fields: File Type and File Creator. This section is applicable only if the MacBinary check box has been checked (see earlier).

Make whatever changes are necessary and click OK to save.

Adding New Lines to a Map File

Adding a new line is simple. Click on the line that you want the new line to follow. From the map editor's Edit menu, select Insert Line. Afterburner will display a dialog box for constructing the elements of the new line.

The following external file types are not automatically added to a map file; you must add them by inserting new lines:

MOA Asset Xtras (.x16, .x32, etc.)

Authorware Video Player DLLs (.VDR)

Authorware Movie Player DLLs (.XMO)

Director M5 executables and support files

To add a new line, include the following five column entries:

File Type: bin

Platform: win, mac, all, etc.

Server filename:

Local filename:

Flags: Preempt, OnDemand, etc.

After you add a line, you can double-click and edit it like any other map file line.

Using Custom Windows Fonts

You cannot include Windows fonts (FNT files) in a map file. If they are present, Afterburner for Authorware will ignore them. If you want to use custom Windows fonts, you must download them separately and install them into Windows in the normal fashion for installing fonts.

Editing a Map File on a Mac

Until Macromedia adds an internal map editor to Afterburner for Authorware for Macintosh computers, like the one it has for Windows, you must adhere to the following procedures to edit map files on the Mac.

An Authorware map file is a text file. Therefore, you can use any text editor to edit it. As an alternative, you can edit Mac map files in Windows by using the map editor in the Windows version of Afterburner for Authorware.

The format of the lines that appear in a Mac map file is identical to the format of the lines in a Windows map file. Refer to the previous Windows section for a complete description of the line types and their content.

Downloading External Mac Files

Before you download a Mac file, you need to perform two tasks: flatten the file and add the MacBinary flag to the map file. The MacBinary flag tells Shockwave for Authorware that the file has been flattened. (See "Editing External Lines," earlier in this chapter, for an explanation of flattening and the MacBinary flag.)

The Afterburner software automatically flattens external files for use by Shockwave for Authorware on a Mac. Next, using a text editor, add the word macbinary to the fifth column of the bin line containing the flattened file reference. Multiple flags can appear in the fifth column if they are separated by commas (for example, macbinary, recycle).

Text and Quicktime Files on a Mac

Two types of external files do not need to be flattened before Shockwave for Authorware can use them on a Mac-text files and Quicktime movies that have been cross-platformed and saved with a .mov extension. Text files do not contain a resource fork, so you won't have to combine resource and data forks (which is the function of flattening). The flattening process (or cross-platforming) moves critical information to the data fork. The .mov extension tells the Shockwave plug-in the file creator and file type for the Quicktime movie.

Using Custom Mac Fonts

Unlike custom Windows fonts, you can package custom Mac fonts with an Authorware application. Authorware will recognize these fonts and include them when the application is run by Afterburner for Authorware on a Mac.

Allowing Windows and Macs to Share External Files

Windows doesn't recognize flattened files. Mac requires flattened files. Mac recognizes a flattened Quicktime movie as flattened, but Windows just sees it as a file that it understands. In order for both Mac and Windows to recognize a Quicktime movie, the map line must appear in a format that both platforms can recognize.

Depending on the intended platform(s), one of three lines must appear. Following are descriptions of those three lines.

The following is an external line referencing a Windows Quicktime file:

bin    win

The following is an external line referencing a Mac Quicktime file that has been flattened:

bin    mac    macbinary

The following is an external line referencing a Quicktime file for cross-platform use:

bin    all    type='MV93',creator='MD93'

The Windows-only line contains the file type, the platform, and the server and client filenames.

The Mac-only line contains the file type, the platform, the server and client filenames, and the macbinary flag indicating that the file has been flattened.

The third entry, the cross-platform line, contains the file type, the platform, and the server and client filenames. In addition, it contains explicit file type and file creator references.

Speeding Up Mac and Cross-Platform Files

Rather than using Afterburner to flatten files, you can improve the performance of external files by manually entering the file type and file creator information, as shown a few paragraphs earlier.

By providing the file type and file creator information, you do not need to flatten files. This information improves performance because flattened files must be unflattened before playing. However, some files, such as Quicktime files, must be flattened to play in a Windows environment.

Using Transition Xtras

You won't need to download the Director transition Xtra as an external file, because it is included with the Shockwave for Authorware plug-in. However, if you plan to use transition Xtras (transitions created by third-party developers, not as part of the basic Director package), you will need to download those Xtras into an Xtras folder at the start of the application.

For the Windows environment, you can accomplish this task by adding the line put XTRAS immediately preceding the Xtras entry(s) in the map file, such as the following example:

put    XTRAS

bin    win32        xtraTrans.x32    XTRATRANS.X32

For the Mac, follow the same format as the Windows version, but add macbinary in the options column (the fifth column):

put    XTRAS

bin    mac        xtraTrans.ab        XTRATRANS.aab        macbinary

Combining Windows and Mac Map Files

After creating both Shockwave versions of an Authorware Application, you will end up with two map files. You need to create links for both versions to your HTML page-one link for the Mac map file and one for the Windows map file. However, if you combine map files into one file, you will need to reference only one map file on your HTML page. This file can contain Mac-only references, Windows-only references, and cross-platform references.

The following is an example of a combined map file. Note the use of comment lines (lines preceded with a number sign-#).

# Combined windows/Mac map file

ver 0

get .

put .

# Windows segments

seg    win    funw0000.aas    0        16840

seg    win    funw0001.aas    32931        16905

seg    win    funw0002.aas    49836        15602

# Mac segments

seg    mac    funm0000.aas    0        17002

seg    mac    funm0001.aas    17002        15603

seg    mac    funm0002.aas    32605        18010

# Windows library lines

lib    win    winlib1.aam        WINLIB1.APR

lib    win    winlib2.aam        WINLIB2.APR

# Mac library lines

lib    mac    maclib1.aam        "LIBRARY1"

lib    mac    maclib2.aam        "LIBRARY2"

# Shared external files

bin    all    MOVIE1.MOV    onDemand

bin    all    MOVIE2.MOV    onDemand

Referencing Files in Multiple Locations

Like seg and bin entries, you can include multiple get and put lines in a single map file. This technique is useful for grouping files by location.

A get or a put entry applies to subsequent line entries. With the put line, if you refer to a folder or directory that doesn't exist on the user's computer, the Shockwave for Authorware plug-in will create it.

With a get line, you can refer either to an absolute or a relative path. For example, if the HTML document is c:\mysite\HTML and the Authorware application files are in c:\mysite\HTML\myapps, the absolute path is c:\mysite\HTML\myapps, while the relative path is myapps. The relative path assumes the location of the HTML document and adds only the subdirectories needed to point to the correct folder or directory.

If you plan to use Xtras (other than the Director transitions Xtra that comes with Shockwave), use a put XTRAS line before the lines that refer to the Xtras. Remember, you must download transition Xtras to the XTRAS folder before the application begins.

With a put line, use relative paths only. The Shockwave for Authorware plug-in does not recognize absolute paths.

The following map file includes multiple put lines. Transitions are put into the XTRAS folder (a relative path off the HTML document folder). Text files are put into a TEXT folder that is located in another folder, MEDIA, off the directory containing the HTML document. The movie file is put into a MOVIE folder that is also a subdirectory (or subfolder) of the MEDIA folder.

ver 0

get .

# this is a Windows-only map file

seg    win     news0000.aas     0        24404

seg    win     news0001.aas     24404    28003

seg    win     news0002.aas     52407    22915

# this line directs the next files to be placed into the XTRAS folder

put    XTRAS

bin    win16   transit.x16      MYTRANS.X16

bin    win32   transit.x32      MYTRANS.X32

# this line directs the next files to be placed into the MEDIA/TEXT folder


bin    win     readme.txt       README.TXT

bin    win     ordering.txt     ORDER-ME.TXT

# the above text file platform entries could have been all, instead of win

# because text files are cross-platform files. However, because this  is

# a Windows-only

map file, it seemed appropriate to make reference only to Windows.


# The next line directs the files that follow to be placed

# into the MEDIA/MOVIE folder


bin  win  MYMOVIE.MOV  onDemand

You can make an external file accessible to more than one Authorware application by using the same put line and external filename in different map files. Be sure to include the recycle option, to prevent the file from being deleted when the application is closed.

Authorware Bandwidth Issues

As with Director, Authorware must contend with bandwidth issues-at least if it is on the Internet rather than on an intranet. If the application is on an intranet, the bandwidth is typically 1.5Mbps (a T1 line) or greater. However, applications are quite often on the Internet, or are on intranets but connected off-site via ISDN lines (or 28.8 or 14.4Kbps modems).

Even if you are accessing an Internet application with a T1 or ISDN, slower modems tend to slow down the Internet, giving these faster lines the throughput of a 28.8Kbps modem.

A 14.4Kbps modem transfers information at about 1KB (one kilobyte, or 1024 bytes) per second. At this speed, a user would have to wait at least two minutes for a 120KB application to download.

For a chart showing some relative download times, based upon application size, refer to Table 29.6 earlier in this chapter.

Because most people use 14.4 and 28.8Kbps modems, 100KB is about the largest file size you should create for a shocked application. To reduce delays, use the onDemand flag to prevent files from downloading, unless needed. You can also use segment sizes to alter access times. With small sizes, the delays are shorter but there are more delays. With larger segments, the delays are longer, but less frequent.

On intranets with T1 lines, file size is much less of an issue. A 1MB file will take only a little more than 30 seconds to load.

Until technology catches up and bandwidth issues no longer exist, you will have to be aware of file size and continue to use onDemand to reduce download delays.

New Shockwave-Specific Functions and Variables

Several new functions and variables

make Authorware easier to use for Internet and intranet applications. These functions and variables address needs specific to Internet and intranet environments. The needs focus primarily on references to HTML documents (Net pages) and URLs.

GoToNetPage(URL), window

Attaching the GoToNetPage(URL) function to a button or hotspot causes Netscape to load the Web page listed in (URL).

You can also add a second optional argument to this function. This argument is a target to HTML windows. Windows are a part of Netscape's Frame technology, and you should study Netscape Frame Scripting to understand the use of frames and HTML windows. Table 29.8 lists possible target options for the second (the window) argument.

Table 29.8. Options for the GoToNetPage window argument.

_blankCauses the Authorware application to remain in a window while a second window displays the new Web page. You can use this method to return to the Authorware application after viewing the Web page.
_selfCauses the new Web page to open in the same window as the current page.
_parentCauses the new Web page to open in the same frameset parent window as the current page. When you are using target windows, this option overrides a globally assigned base target (the default window). If there is no parent, this argument functions the same as the _self argument.
_topCauses the new Web page to open in the body of the current window. This option is equivalent to the _self argument. It is also used to return from frame nesting.
If you do not include a second argument, the Authorware application closes as soon as it locates the new Web page.

Use a comma to separate arguments; for example, URL,"_blank".

An example of the GoToNetPage(URL) function is

GoToNetPage("", "_blank")


The NetDownload(URL) function

downloads the file listed in (URL) to the user's computer. The full pathname is returned if the operation was successful. This function, in combination with the onDemand flag in the map file, enables files to be downloaded only when requested.

NetDownload(URL) looks at the map file and downloads to the location listed by the put line of the map file that precedes the line entry for the file being downloaded. If the map file does not have an entry for the file being downloaded, it will be downloaded to the DOWNLOAD subfolder of the folder containing the Authorware plug-in.

In the following example, an Adobe Acrobat file is downloaded and, when the process is complete, returns the pathname to a string called WherePut:

WherePut:= NetDownload("

The file was located on the HTTP server in the folder FILES. After downloading, the WherePut: variable will contain the location of the file on the client computer (the user's computer). If the map file does not have a line for newsletter.pdr, then WherePut: might contain "C: \NETSCAPE \PLUGINS\AP32ASW\DOWNLOAD".

However, if the map file includes an entry for newsletter.pdr, and a put line precedes the entry, the file will be placed into the folder specified by the put line. The folder location will be a subfolder off the Authorware plug-in folder. If, for example, the put line was put PDRS, the WherePut: variable would contain "C:\ \NETSCAPE\ \PLUGINS\AP32ASW\PDRS".


NetPreload(IcondID@"IconTitle") is an

asynchronous command that downloads whatever segment files the icon specified by IconTitle requires to execute. If the IconTitle is a map, interaction, decision, or framework icon, "all" icons that are either attached to (external) or within (internal) the IconTitle are preloaded.

The primary function of the NetPreload function is to initiate background preloading of segments required for sounds, movies, or graphics, so that the segments are on the user's system when needed.

NetPreload does cause the system to slow down or halt during the load process, so you should time the function to operate during the most optimum moments. For example, a good time to initiate a NetPreload function might be when a user is looking at a newly downloaded map, since the system is halted for the moment.

Preload cannot asynchronously preload external files, such as digital video files. It downloads segments (seg), not executables (bin). Use the NetDownload(URL) function to download executables.

The difference between the NetPreload function and the preload option is that the preload option stores the data in Authorware's memory, while NetPreload stores the information on the user's computer drive.

The function returns information, but the information serves no purpose and Authorware ignores it.


NetConnected is a flag variable (1=TRUE, 0=FALSE). It tells the Authorware application if it is running via Shockwave. The value is 1 if the application is running under Shockwave and 0 if it is running either under Authorware's runtime routine or in the authoring environment.

This variable is useful with calculation icons or decision icons to branch according to the environment on which the Authorware application is playing, for example:

if NetConnected then

    Platform := "Running on an HTTP server"


    Platform := "Running stand-alone"

end if

The NetConnected variable is a handy way of building a single piece of code that can run in multiple environments. The appropriate media will be accessed according to the results of the NetConnected variable. For example, you might want to use 8-bit, 11KHz, mono sound on an intranet, but 16-bit, 44.1KHz, stereo sound on a stand-alone application.


The NetLocation flag returns the URL of the current Shockwave application. A useful routine is to use the NetConnected flag to determine if the Authorware application is running on the Internet or as a stand-alone application. Then, either retrieve a file off the HTTP server in a file relative to the NetLocation if the application is running on the Internet or retrieve the file off the hard drive or a CD-ROM using a local address if the application is running in stand-alone mode.

Existing Authorware Functions

The following are functions that already exist in Authorware but have been adapted for use on the Internet or on an intranet:

Jumpfile and JumpFileReturn

The Jumpfile and JumpFileReturn functions enable Authorware to jump from one Authorware application to another and return to the calling Authorware application. The function has been altered to accept a URL as its first argument. The following is an example:


Jumpfile and JumpFileReturn might be affected by user-selected security settings-they might be disabled. (See "System Security," later in the chapter.)


ReadExtFile now accepts an absolute URL as an argument. The URL must begin with either http://servername/ or file:///.

The following code reads an external file and returns its entire contents to the string MyText:

MyText := ReadExFile("http://hostserver/mysite/mytextfile.txt")

As with the JumpFile and JumpFileReturn functions, the ReadExtFile function might be affected by user-security settings.

System Security

With the Shockwave for Authorware plug-in, users have the opportunity to set one of two security modes: trusting and nontrusting. Simply put, trusting mode says that you trust the integrity of external files and are willing to download them. Nontrusting mode says that you are afraid that your system might become corrupted, that plug-ins might read confidential files off your system and transfer them back to an HTTP server, or that a virus might be introduced and that you would rather not download any files that could compromise your computer.

Both of these modes apply to Authorware running on the Internet. On intranets, the assumption is that the MIS staff has taken the responsibility of assuring system and file integrity and that all downloads are safe.

Nontrusting mode disables the following functions and variables:





The ReadExtFile is disabled only for reading files off the user's hard drive, not for reading files off the HTTP server (files whose path begins with http://).

Because nontrusting mode prevents the automatic downloading of UCDs, DLLs, XCMDs, and Xtras, you must place these files on the user's system manually.

In nontrusting mode, Xtras are not looked for by Authorware in the following locations, depending upon the client system:

Windows 3.1x and NT
Windows 95
Program Files/Macromedia/Xtras
System Folder:Macromedia:Xtras

Invoking Security

Whenever you launch an Authorware application via an HTTP server (an Internet or intranet), the first thing you see is a security dialog box. You also see the security dialog box whenever you use either the JumpFile or GoToNetPage function.

The Security Dialog Box

The Security dialog box opens with the full HTTP pathname of the Authorware file, followed by two check boxes-one to select trust mode and one to select nontrust mode.

You can also select the Security Options button to access another dialog box, which has two more boxes: Trust All Sites and Trust Only Listed Sites. If you check the second option, the bottom half has a screen for entering the names of the sites you trust.

Just below the top of the Security Options box is a section titled Show Security Dialog When: followed by two check boxes, one for when Opening Trusted Sites, and one for when Opening Non-Trusted Sites. By checking one of the boxes, you can select when you want to display the Security dialog box.

The Security Options dialog box also has buttons for adding, deleting, and renaming sites, as well as for saving current settings.

Remember, even though you can open an Authorware application in nontrusting mode, it might not function properly because you might have inhibited some of its functions or features.

Integrating Authorware into Browsers

To access Authorware using a browser, you must have the Shockwave for Authorware plug-in, and you must be using a browser compatible with the plug-in. Currently, the only browser compatible with the Authorware plug-in is Netscape (versions 2.0 and 2.01).

You add Authorware shocked applications to an HTML document the same way that you add Director Shockwave files to an HTML document-via the EMBED tag, as follows:

<EMBED SRC="myapp.aam" WIDTH=640 HEIGHT=480 WINDOW=onTop>


<EMBED begins the HTML tag sequence.


SRC="?????.aam" defines the filename of the Authorware shocked file.

WIDTH= ###

WIDTH= ### describes the width, in pixels, of the Authorware application.


HEIGHT=### describes the height, in pixels, of the Authorware application.


The WINDOW setting defines how the Authorware application will appear on the Netscape browser. This command has three possible options: inPlace, onTop, and onTopMinimized.


The inPlace option embeds the application within the HTML page in the browser. The option is only applicable when viewing in the Windows environment.

This option does not enable you to include a title bar in the application. If you try to include a title bar, it will not display, but the application's height will be reduced by the size of the title bar (even though it is not displayed).

Because Netscape's active window is smaller than the screen's full window size, be sure to create applications with height/width settings smaller than 640´480. Otherwise, users with screens set to 640´480 (the current LCD-lowest common denominator) will have to scroll vertically and horizontally to see the entire application.

Also, the ResizeWindow and MoveWindow functions can produce unpredictable results.


onTop displays the application in a separate window on top of the Netscape browser windows. This window makes the Authorware application appear to be a separate application, that is, not part of the HTML document.


This final option, onTopMinimized, like the onTop option, places the Authorware application in a separate window. However, onTopMinimized also minimizes the browser, which makes the Authorware application appear to be a stand-alone application.

Displaying an Alternate Image on Noncompatible Browsers

Because the only browsers that can read the Authorware application (as of this writing) are Netscape 2.0 and 2.01, all other browsers need something else to view. The <NOEMBED> command accomplishes this task.


When Netscape sees the <NOEMBED> command, it ignores anything that follows until it sees the </NOEMBED> tag, which designates the end of the <NOEMBED> sequence.

All other browsers do not understand the <NOEMBED> tag. Instead of ignoring everything that follows the <NOEMBED> tag, they read everything that follows.

To provide an alternate image for non-Netscape browsers to view while Netscape browsers access the Authorware application, place the alternate image information within the <NOEMBED> and </NOEMBED> tags. In the following code, Netscape will play the Authorware application myapp.aam while all other browsers will display the image alt-img.gif, which is located in the IMAGES folder on the server.

<EMBED SRC=myapp.aam" WIDTH=320 HEIGHT=240 WINDOW=inPlace>

<NOEMBED> <IMG SRC="images/alt-img.gif"> </NOEMBED>

Shockwave for Freehand

The final Macromedia application that a Shockwave plug-in has ported to the Internet is Freehand.

Freehand is a cross-platform, vector-based, draw package that incorporates sophisticated special effects via Xtras plug-ins, such as Smudge, Fisheye Lens, and 3D Rotation, along with powerful page layout capabilities to rival programs such as PageMaker and QuarkXPress.

You can use Freehand to create exciting page-based documents. With the inclusion of Shockwave, these pages can appear on the Web.

Obtaining Shockwave and URL Managers

In order to turn a Freehand graphic into a shocked graphic, you need to download Afterburner for Freehand and URL Manager Xtras for Freehand. These files are available, free of charge, from the Macromedia's Web site at

Embedding a Freehand Graphic on an HTML Page

When a graphic is created in Freehand, you can use Freehand's Page inspector to determine the page size. First, use the Page inspector to set the unit of measure to points. There are 72 points to the inch. This measurement is equivalent to the number of pixels per inch. For example, a 3-inch wide graphic is 216 points (72´3) wide, which means that it is approximately 216 pixels wide.

Macromedia recommends following these steps:

  1. Select all the objects on the Freehand page.
  2. Group them together.
  3. Move the group to the lower-left corner of the page.
  4. Make a note of the measurements (height and width, in points) that Freehand's Object inspector displays.
  5. Enter the measurements you just wrote down as custom page dimension in Freehand's Page inspector.
  6. Notice that the page size matches the size of the grouped items.

Now that you have a page designed to match the size of the graphic element it contains, you can add the document to the HTML document.


As with Director and Authorware shocked files, Freehand shocked files are placed into an HTML page via the <EMBED> tag, using the following format:

<a> <embed SRC="fh-file.ext" WIDTH=480 HEIGHT=360 toolbar=top></a>

<a> </a>

The <a> tag and closing </a> tag denote that the information between them is a hypertext link.


The SRC element defines the name of the freehand file to be embedded.


WIDTH and HEIGHT define the size, in width and height, of the Freehand graphic image. Use the width and height dimensions that you copied down during the preceding step 4 for the WIDTH and HEIGHT dimensions.

You can also display the Freehand graphic in a size that is smaller than its original size. If, for example, the original graphic is 480´360 and you want to display it at 50 percent of its original size, just enter 240 for the WIDTH and 180 for the HEIGHT.


You can display a toolbar on a Freehand graphic by using the TOOLBAR element of the EMBED tag. The TOOLBAR element has two possible values: top and bottom. With top, the toolbar will appear at the top of the Freehand graphic. With bottom, the toolbar appears at the bottom of the Freehand graphic.

The toolbar gives users access to the panning, zooming, and linking features of Shockwave for Freehand.

If you are using a toolbar, be sure to add the height of the toolbar (20 pixels) to the HEIGHT listing of the EMBED tag. For example, if you want to use a toolbar in the example with the 480´360 graphic, the HEIGHT becomes 380 (360 + 20 pixels).

To use a toolbar, the graphic must be at least 85 pixels wide. The toolbar automatically resizes itself to fit the width of the Freehand graphic. However, unless the toolbar is 150 pixels wide, it does not have enough room to display the Shockwave logo. Although not displaying a logo might not seem important, it is, because the logo is a hotspot. Clicking on the logo returns the graphic to its original view. If you cannot see the logo, either you will have to guess at the original view and use the zoom and hand tools to re-create that view as best you can, or you will have to use a keyboard command for the return-to-original-view function normally accomplished by clicking the logo. On the Mac, the keyboard combination is Command+Shift-click. On the PC, it's Ctrl+Shift-click. See Table 29.9 for the keyboard alternatives to the toolbar.

Table 29.9. Keyboard alternatives to the toolbar.

OperationComputer Method
Zoom inMacCommand-click.
Zoom outMacCommand-Option-click.
Home viewMacCommand-Shift-click.
Zoom inPCRight-click or Ctrl+Left-click.
Zoom outPCAlt+Right-click or Ctrl+Alt+Left-click.
Home viewPCShift+Right-click.
Zooming a selectionEither Click and drag a selection box.
PanningMacHold down the control key and click and drag.
PanningPCHold down the spacebar and click and drag.

Activating a Link in Netscape

When you move the cursor around the Freehand graphic in Netscape, the cursor turns into a pointing finger when it rolls on top of a hyperlink. Click to activate the link.

The URL Xtra

Although being able to place vectored graphics onto a Web page is certainly nice, Shockwave for Freehand also enables you to attach hyperlinks to vectored objects, turning them into hotspots.

In the Freehand program, you can use the URL Xtra to add hyperlinks to the graphics.

Freehand accesses the URL Xtra via Other in the Windows menu.

Creating a hypertext link is a two-step process. First, you add the URL information to the URL palette, and then you attach the URL to an object.

Adding a URL

To add a URL to Freehand, access the URL Xtra from the Windows menu and select New from the Options menu. Enter the URL into the New URL dialog box. URLs can either be absolute or relative paths (full or partial paths). Relative paths are relative to the folder containing the Freehand graphic.

You cannot add URLs to groups, but you can add them to individual objects within a group.

Attaching the URL to an Object

From the URL palette, drag the URL to an object. To attach the URL to multiple objects, select the multiple objects and click the URL in the URL palette.

URLs that have not been attached to at least one object before the Freehand graphic is saved will be deleted and not saved. This rule also applies to closing or zooming the URL's window or sending the graphic to the background.

Editing, Copying, and Deleting URLs

To edit a URL, just double-click it (or click it and select Edit from the Options menu on the URL palette). Press Enter when you are finished editing.

To copy a URL, click the URL to select it. Then select Duplicate from the Options menu on the URL palette.

To delete a URL, click on the URL to select it. Then select Remove from the Options menu on the URL Links Manager.

Note that this step will also remove any hotspots (the link, not the objects) associated with the URL.

Finding URL Associations

After URLs have been attached to Freehand objects, you can find them by using the Find button located in the URL palette. By clicking on a URL, selection handles will appear around any and all objects associated with that URL.

Afterburner for Freehand

Now that you've created your graphic and added hotspots with URL links, you need to turn the graphic into shocked graphics so it can be played on the Internet.

As soon as you save a Freehand graphic (in its normal fashion), it is ready for use in an HTML document. All you need to do is add either a .fh5 or .fh4 extension, depending upon which version of Freehand you used to create the graphic. Although this method is simple, the more appropriate procedure for creating a shocked Freehand document is to use Freehand's Afterburner Xtra, located in the Freehand Xtras menu.

The reason the Afterburner Xtra is used is because it compresses the file, reducing its size. As with all other shocked file formats mentioned in this chapter, size is important because of Internet and intranet bandwidth considerations.

To compress Freehand graphics, select Compress Document from the Afterburner menu. (Be sure to save your document before compressing.)

Afterburner saves compressed graphics with the .fhc extension, which signals the Netscape Shockwave for Freehand plug-in to decompress the document.

While compressing, you can lock the compressed graphic by clicking the Locked option. However, Freehand cannot reopen locked files; you will need a browser to view them. If you plan to lock your graphic, be sure to save an original version first so you have a version of the graphic that Freehand can reopen and alter.

Opening Compressed Graphics in Freehand

After Afterburner compresses a file, Freehand can reopen it, as long as you did not select the Locked option.

From Freehand's Afterburner menu (under Freehand Xtras), choose Decompress Document. Locate and select the file you wish to decompress.

When the file opens, its name will be untitled. You will need to name the file before saving and before compressing again.

Using Fonts

As with Director and Authorware, fonts are always an issue when creating cross-platform applications or when using custom or specialized fonts, even within a single platform.

To reduce problems, use the most common fonts (Courier and Times). However, even these fonts are not the same across platforms and might produce results that you do not expect.

To ensure that what you want is what you get, turn all fonts into vectored polygons (freeform objects).

Features Disabled for Shockwave for Freehand

Certain Freehand features have been disabled in the shocked version of Freehand. Primarily, they are effects or features available on the development platform but not necessarily available on the delivery platforms.

  • Encapsulated Postscript (EPS) file format. Because file size is a paramount concern in the Internet, and because EPS files are not space-efficient, this format is not supported for shocked files.
  • Multiple pages. The page that was active (selected) when the document was saved will be the one displayed on the HTML document. Other pages can be viewed by panning.
  • PostScript lines and fills (for example, custom fills).
  • Linked TIFF files (embedded TIFFs are supported).
  • Text effects.
  • Tab leaders.
  • Range kerning.

Configuring Servers

In order for HTTP servers to display Shockwave files properly, you must configure the servers to accept the appropriate MIME type for each type of Shockwave file. Depending upon the host server, the code will vary. The following are the formats for configuring various server types for the different Shockwave formats.

Three server types are covered.

  • UNIX
  • Mac
  • Webstar


The UNIX system was the first system used on the Internet. Until recently, all Internet servers were UNIX-based.

Shockwave for Director 4.0x-The Do-It Yourself Method

In order to have a server display the various Shockwave MIME types (file extensions), references for the MIME types must be added to the appropriate server file(s). Each server type locates the MIME information in a different file or group of files and in a different format. Also, some files can be edited simply by opening them with a text editor, while others require access through specialized programs. The UNIX file containing MIME information is edited via any text editor.

  1. Create or open a file called htaccess (or a variation, depending upon your system).
  2. Set the file access permission by adding the following lines to the file:
    user = read and write
    group = read
    world = read
  3. Set file privileges to world readable by adding
    chmod 644 .htaccess
  4. Add the following lines:
    AddType application/x-director dcr
    AddType application/x-director dir
    AddType application/x-director dxr
  5. Save the file to the root level of your Web pages.

Shockwave for Director 4.0x-The System Administrator Method

The system administrator must add the following lines to the system file that registers MIME types for the server:

MIME type: application

Sub Type: x-director

Extensions: dcr,dir,dxr

Shockwave for Director

Follow the same procedure as for Director 4.0x.

Shockwave for Authorware-The Do-It-Yourself Method

Follow the same procedure as for Director 4.0x. However, for the AddType entries, type the following:

AddType application/x-authorware-map aam

AddType application/x-authorware-seg aas

AddType application/x-authorware-bin aab

Shockwave for Authorware-The System Administrator Method

The system administrator must add the following lines to the system file that registers MIME types for the server:

MIME type: application

Sub Type: x-authorware-map

Extension: aam

MIME type: application

Sub Type: x-authorware-seg

Extension: aas

MIME type: application

Sub Type: x-authorware-bin

Extension: aab

Shockwave for Freehand

The system administrator must add the following lines to the system file that registers MIME types for the server:

MIME type: image

Sub Type: x-Freehand

Extensions: fh4,fh5,fhc


As with the UNIX system, the Mac file containing MIME type information can be edited using any text editor.

Shockwave for Director 4.0x

Add the following lines to the file MacHTTP.config:

BINARY .DIR TEXT * application/x-director

BINARY .DXR TEXT * application/x-director

BINARY .DCR TEXT * application/x-director

Shockwave for Director

Follow the same procedure as for Director 4.0x.

Shockwave for Authorware

Add the following lines to the file MacHTTP.config:

BINARY .AAM TEXT * application/x-authorware-map

BINARY .AAS TEXT * application/x- authorware-seg

BINARY .AAB TEXT * application/x- authorware-bin

Shockwave for Freehand

Add the following lines to the file MacHTTP.config:

BINARY .FH4 TEXT * image/x-Freehand

BINARY .FH5 TEXT * image/x-Freehand

BINARY .FHC TEXT * image/x-Freehand


Unlike the UNIX- and Mac-based servers, MIME information for Webstar servers can be changed only with the WebSTAR Admin application. For each Shockwave format, the steps required to add the MIME information are described next.

Shockwave for Director 4.0

  1. Start the application called WebSTAR Admin.
  2. Select your server (it must be running) from the Pick A Server window.
  3. Select Suffix Mapping from the Configure menu.
  4. Choose the following settings:
    Action: BINARY
    File Suffix: .DCR
    File Type: TEXT
    Creator: *
    MIME Type: application/x-director
  5. Repeat the last four steps to add MIME information for DIR and DXR suffixes.
  6. Close the application.

Shockwave for Director

Follow the same procedure as for Director 4.0x.

Shockwave for Authorware

The process for adding Authorware MIME type information is the same as the procedure for adding Director MIME information. Only the entry information varies.

  1. Start the application called WebSTAR Admin.
  2. Select your server (it must be running) from the Pick A Server window.
  3. Select Suffix Mapping from the Configure menu.
  4. Choose the following settings:
    Action: BINARY
    File Suffix: .AAM
    File Type: TEXT
    Creator: *
    MIME Type: application/x-authorware-map
  5. Repeat the last process for AAS and AAB suffixes with MIME types as application/x-authorware-seg and application/x-authorware-bin, respectively.
  6. Close the application.

Shockwave for Freehand

Just like adding Authorware and Director MIME types to a WebSTAR server, the WebSTAR Admin program must be used in the following manner.

  1. Start the application called WebSTAR Admin.
  2. Select your server (it must be running) from the Pick A Server window.
  3. Select Suffix Mapping from the Configure menu.
  4. Choose the following settings:
    Action: BINARY
    File Suffix: .FH4
    File Type: TEXT
    Creator: *
    MIME Type: image/x-Freehand
  5. Repeat the last process for FH5 and FHC suffixes.
  6. Close the application.


Shockwave is a powerful plug-in for experiencing interactivity on the Internet and intranets. Afterburner is the developer's tool that turns a Shockwave-compatible application into a shocked file, ready for use in the HTTP environment.

In some cases (such as for Director files), Afterburner is virtually a one-click operation. In other instances (as with Authorware), Afterburner is a more complex process, requiring dialog box entries and even text editing. But, in all cases, Afterburner and Shockwave are only afterproducts of sophisticated programs.

Authorware and Director in particular are extremely powerful applications capable of creating limitless interactivity and animation, incorporating sound, pictures, and digital video. Afterburner and Shockwave are just a small portion of a very long learning curve. For both programs, Afterburner and Shockwave provide additional language interpreters, enabling the programs to utilize HTTP-specific commands and functions.

With all three programs-Authorware, Director, and Freehand-Afterburner turns a desktop or LAN-based product into an Internet- and intranet-capable program, adding features important for an interactive experience, including point-and-click hypertext linking to URLs and to Internet-compatible media.

To assist you in finding more information on the subjects covered in this chapter, and the products and vendors mentioned, the following list of Internet resources has been compiled:

Silicon Graphics: