Articles Archive
Articles Search
Director Wiki
 

Putting your Director project on a CD-ROM: Part 1

March 21, 2000
by Will Turnage

With the Internet now asserting control over just about everything, it seems that these days more and more Director work is Shockwave based. For some of us though, the bulk of our work still revolves around the good old CD-ROM.

As great as the Internet is, CD-ROMs are still used frequently because they are the best solution for delivering high quality, rich media like video and audio. They’re also small, portable, hold a large amount of data, and in many instances, don't require an Internet connection.

This is the first of two articles describing a few key points you should consider when moving your Director pieces to CD-ROM. This article will discuss preparing your Director files for burning onto a CD-R, and the second part will cover the CD burning process as well as some things you should know before sending your work off to a replication house.

But for now, let's talk about three ways you can make the transition from hard drive to CD-ROM as painless as it needs to be.

How to make your Director movies CD friendly

So it’s two days before your deadline, and your project is completely finished. No problem, you say, I’ll just burn a CD and be done with it. But when you launch your first CD-R, instead of your splash screen, Director throws up a nasty dialog box that says “Can’t find e:\projects\clients\movie.mpg” and asks you to locate the file. No sooner do you dismiss that dialog box when Director throws up another one asking you to find yet another media file. Suddenly, Director can’t seem to find any external file, whether it’s a MIAW, video file, external cast, or other Director movie. And you don’t know where to begin.

Luckily, there are two simple things you can do to prevent this from happening on your project. The first is to always use relative path names when referring to a file’s location. Even if your project is for just one platform, you should never hard code a path name (such as c:\sample.dir) into your movie, because you can never be sure that your user's computer is identical to yours. To use relative path names in your movies, there are two Lingo constants you can use to help out.

The first term is 'the moviepath', a lingo property that returns the directory of the current movie.

put the moviePath
-- "C:\projects\DOUG\"

When assigning file names or going to another movie, you should always include the moviePath with your path name. This is a safe step to prevent those "File missing…" dialog boxes from appearing. Since the moviePath is a string, you can just combine it with your file name in Lingo. For example:

Member(“video_01”).filename = the moviePath & ¬
  “video_01.mpg”

If your files are in another folder though, you’ll have to use a backslash on Windows machines or a colon on the Macintosh to separate different directories. For example, if your videos were in the folder ‘video’ which was inside the folder ‘media’, then you would have to determine the platform and then use the appropriate delimiter. For example:

if the platform contains “Windows” then
  member(“video_01”).filename = the moviePath ¬
    & “media\video\video_01.mpg”
else
  member(“video_01”).filename = the moviePath & ¬
    “media:video:video_01.mpg”
end if

The second lingo term is 'the applicationPath', a lingo property that returns the directory of the current application that’s running. When in authoring mode, the applicationPath always returns the directory of the Director app.

put the applicationPath
-- "C:\PROGRAM FILES\MACROMEDIA\DIRECTOR 7\"

When you’re running a projector though, the applicationPath always returns the directory of the original projector, regardless of whether you’re viewing a Director movie in a different directory.

Put the applicationPath
-- “C:\Projects\Doug”
go movie (the moviePath & “activities\lesson1.dir”)
put the applicationPath
-- “C:\Projects\Doug”

Even if we make it a habit to always use relative paths, there are bound to be some times where we miss something. In those instances, there are two more Lingo terms that we can use to help Director find the files it’s looking for.

The first Lingo term is 'the searchCurrentFolder', a system property that tells Director if it should search for a file or not. 'The searchCurrentFolder' can be true or false, and is true by default. The second Lingo term is 'the searchPaths', a list that contains all the directories where Director should search for a file. The list is empty by default, but it's wise at the beginning of each of your movies to add any path containing external media to 'the searchPaths'. For example, if you have directories called “video”, “audio”, and “images” with your linked media you’d do it this way:

on prepareMovie
  if the platform contains “Windows” then
    set platformDelimiter = “\”
  else
    set platformDelimiter = “:”
  end if
  add (the searchPaths), the moviePath & “media”
  add (the searchPaths), the moviePath & “media” ¬
    & platformDelimiter & “video”
  add (the searchPaths), the moviePath & “media” ¬
    & platformDelimiter & “audio” 
  add (the searchPaths), the moviePath & “media” ¬
    & platformDelimiter & “images”
end

How to make sure your Director application launches quickly from a CD

Another problem often encountered with projects running from a CD is that they take way too long to start up. Programs that seem to fly open from your hard drive are now taking over 10 seconds to launch from a CD. Luckily, there are a few simple things you can do to speed up the launch of your projectors.

The first cardinal rule is to never embed Xtras into a projector. When you embed Xtras, Director compresses and bundles them with the executable file. While this single file can be nice visually, the trade off is that every time you launch the projector it has to decompress the Xtras and place them in a temp folder on your hard drive. If you’re running from a CD-ROM, then on top of the decompression work the Projector has to copy the Xtras from the CD to your hard drive as well before it will run your movie. Also, there are a few known instances where Xtras don’t unbundle themselves properly, in which case, your projector won't even work at all. So it's safest to always keep your Xtras separate from your projector.

To make sure that Xtras aren’t included with your projectors, select Modify -> Movie -> Xtras from the menu in Director. Select each Xtra you’re using and make sure that the ‘Include in Projector’ box in unchecked.

You can also speed up your projector’s launch time by using what’s known as a stub projector. A stub projector is essentially a very small launcher movie. In its most basic form, it’s a one frame movie whose only command is a frame script that says ‘go movie “start”’ – assuming that “start” is your first dir file. However, stub projectors don't have to be this basic. Some developers create stub projectors that also allow them to set system properties, or to initialize global variables.

Whether it’s a basic stub or a complex loading movie, there are two main benefits to creating and using a stub projector. The first one is just a matter of convenience when you're authoring and testing your movie. When you create and use a stub projector, you eliminate the need to recreate the projector every time you make a change to your movie. If your movie is particularly large, you can save a lot of development time by initially creating a stub projector, and then just reusing it again and again.

The second benefit of stub projectors has to do with our main CD-ROM goal – faster launch times. By having such a small Director movie inside your projector, the movie loads extremely fast, and the user sees the Stage (or your splash screen) at a much quicker rate than if they were waiting for a 10MB projector to load all its cast members into memory.

Finally, a last technique available to Windows users is to create a “fast-start” projector. When you create your stub projector, instead of choosing the option for ‘Standard’ player, choose the option for ‘Shockwave’ player. This will create an exe file that is much smaller than normal projectors. Then you need to go into the Macromedia/Shockwave folder in your system folder. There you will find two files named ‘dirapi.dll’ and ‘iml32.dll’. Copy these two files and place them next to your slim stub projector. By creating a projector this way, you save start up time because normally the projector would have to decompress these files, like it does when you embed Xtras in a projector. (Note – Because of the nature of the MacOS, this slim projector technique, while still available, offers no speed advantage over standard projectors on the Mac.)

For a more detailed explanation read the Technote on Macromedia's web site discussing fast start and stub projectors.

How to protect your files

Once you’ve made your stub projectors and filled your movie with nothing but relative path names, you’re finally ready to assemble all your files to burn on a CD.

The last step you need to do with your Director movies and casts is to protect them. Protecting your movies not only compacts them for delivery, it also compiles them so that they can no longer be opened or modified inside Director. This step, while considered a good practice for everyone, is extremely essential for people who write a large amount of proprietary code for their projects and want to keep it protected. The only downside to protecting your movies is that this process is irreversible, so make sure you backup everything before you protect.

To protect your movies, just select Xtras -> Update Movies. Select the Protect option and choose a folder where to backup your originals (it’s also wise to have an extra backup separate from this process). Next, just select all of your movies and casts, click OK, and Director does the rest. When Director is finished you will see that the icons for all your movies have changed and now they have an extension of dxr or cxt.

If you’re planning to protect your movies, changing the extension from dir to dxr and from cst to cxt, it’s vital that you not have lingo references to these movie and cast names that include the .dir or .cst extensions. For example, instead of a lingo command that says…

go to movie “whatever.dir”

… it’s better just to say…

go to movie “whatever”

That way, the command works for either whatever.dir or whatever.dxr, and after you protect your files, your program won’t display an error dialog asking you where to find “whatever.dir”.

Final Checklist

Once your movies are protected and in the place, you're ready to burn a CD. The last thing to check before you burn a CD is to make sure you have all of your non-Director files in order as well. These include, but are not limited to:

where projector.exe is the name of your Director projector. For information on how to create an Autostart CD on the Macintosh, you'll have to wait for the next issue when we talk about the actual CD burning process.

This should give you an idea of how to prepare your files for distribution on a CD. In part two, we'll cover making your CD-R, and what you should know about dealing with CD duplicators.

Will Turnage is a multimedia programmer based in New York City. In addition to his weekly role as Director Online's Multimedia Handyman, he is also the Technology Director for Sony Music's Client Side Technologies Group. You can read more about his work at http://will.turnage.com/.

Copyright 1997-2024, Director Online. Article content copyright by respective authors.