macromedia DIRECTOR MX 1002004 training from the source [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

macromedia DIRECTOR MX 1002004 training from the source [Electronic resources] - نسخه متنی

Dave Mennenoh

نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
افزودن یادداشت
افزودن یادداشت جدید











Understanding Projectors


As you know, a projector is the term used for the executable file that Director creates from your movie. However, you may not have realized what the projector file actually comprises. Besides your movie, possible cast files and of course Xtras are also in the Director player libraries. When your projector starts, all of these items must be unpackaged to the user's hard drive before they can be run. By minimizing what needs to be unpackaged from the projector you can decrease your startup times, sometimes dramatically.

Up to now, you've created a standard projector, which contained your movie, its Xtras, and everything else within the single projector file. While this is convenient, and even sometimes appropriate, it is the slowest of all projectors.

In this section we'll look at two other types of projectors, the stub and fast-start projectors, to see how and why, you might use them in your projects.

The Stub Projector


A stub projector is simply a movie, containing little or no content, used specifically to launch for your application. To this point you've used Lingo's go method to move the playhead to a different frame in the movie. But you can also go to a different frame in a different movie altogether. This way, you can create applications consisting of multiple movies. Aside from keeping file sizes down, this can also greatly help organize things. In addition, a stub projector can reduce the time it takes to publish your movie, and help reduce errors. Let's create a stub projector for the training log now.


1.

Select File > New > Movie from the top menu. Make sure the new movie's Stage size is set to 800x600, and has a black background. Double-click in the behavior channel at frame 5 and enter the following Lingo:


on exitFrame me
_movie.go(1, "myTrainer")
end

By adding the second parameter, you are telling the method to go to frame 1 of the movie named mytrainer. Even if you are in Windows, don't use the file extension here. This is because, as you will learn shortly, you can protect your movies, which changes the file extensions. By not using the extension in the go method, you can go to either the unprotected .dir file, or the protected .dxr version and not cause an error.

2.

Save the new movie as run_me. Save it in your project_two folder, alongside the mytrainer movie.

You need to save the movie in the same folder as the mytrainer movie because no path is specified in the go method. If no path is specified, Director expects to find the movie in the same folder as the current movie.

3.

Select File > Publish Settings. Under Formats, choose to make just a projector, and turn on Preview after publishing. Under the Projector tab, make sure the Player type is Standard, Full Screen isn't checked, and Exit Lock is checked. Press the Publish button.

Press OK to save the movie when prompted and note the results. As soon as the mytrainer movie starts you receive a warning:

[View full size image]

This warns you that the Flash Xtra is needed, but not found. Press OK to dismiss the dialog, and you're presented with more alerts warning you that other Xtras were also not found. Finally, you get a script error asking if you want to continue or not. Press No. The projector closes and returns you to the Publish Settings.

4.

Once you've returned from trying to launch the projector, click OK to close the Publish Settings dialog.

Do you know what went wrong? Recall that Xtras like the Flash Xtra were automatically added to the movie's list of Xtras because you used them in the movie. But that was in the mytrainer movie, not the stub movie. The only Xtras present in the stub movie are the default Xtras that are added to every new movie. The script error happened when the movie tried to instantiate the Arca Xtra.

There are two ways you can fix this problem: by adding the necessary Xtras to the stub projector's list of Xtras, or by creating an Xtras folder and adding the Xtras into that folder. You already know how to add the Xtras to the movie's list (Modify > Movie > Xtras), so let's go the other route and use an Xtras folder.

5.

Choose File > Publish Settings to open the Publish Settings again. Select the Files tab and check Exclude all Xtras. Press OK to close the dialog.

[View full size image]

With the Xtra's list empty you can publish the projector once more, then copy the Xtras you need from Director's folder into your projector's folder. (Before Director MX 2004, excluding all Xtras meant going into the movie's list of Xtras and removing each one individually.)

6.

Press the Publish button on the toolbar to publish the movie to a projector.

See how fast the projector is created, now that you're not packaging a bunch of Xtras into it? When the projector launches, because Preview is on in the Publish Settings, just dismiss the dialog boxes and script error so that the projector closes.

7.

Navigate to your project_two folder. Within it, create a new folder named Xtras.

When the projector starts it will automatically look in the Xtras folder and load any Xtras that are present. All you need to do now is copy the required Xtras over and you'll be ready to go.

8.

Navigate to Director's XTRas folder so you can copy the required Xtras.

In Windows, the path to Director's Xtras folder should be:


C:\Program Files\Macromedia\Director MX 2004\Configuration\Xtras

and on the Macintosh:


OSX Volume Name/Applications/Macromedia/Director MX 2004/Configuration/Xtras

Within the Xtras folder are a bunch of other folders, organized by category, that contain the actual Xtra files. You will need to open the various folders to locate the Xtras you need, then copy each of them into your movie's Xtras folder. The following table lists the Xtras you need, along with the names of the folder they can be found in.

Folder

Xtras

Core

directSound, macroMix, textXtra

Core \ Net Support

inetURL, netFile

Scripting

netLingo

Media Element

Sound Control, swaDcmpr, Font Asset, Font Xtra, Text Asset

Media Element \ Flash Asset

Flash Asset

Arca

Arca

9.

Copy the Xtras from the different folders into your movie's local Xtras folder.

If you're on a Macintosh you won't see some of the Xtras; directSound and macroMix are Windows-only sound Xtras. But don't worryon a Mac, you don't need them.

You might have noticed that several of the Xtras seem to be for sound, even though no sound is used in the movie. They are default Xtras added to every Director movie. Unless you are certain you won't need them, or really need to save on space you can leave them out. Just be sure to thoroughly test your project when finishing it.

Once you've got all the Xtras copied into your local XTRas folder, you can see how the projector works.

10.

From your project_two folder, launch the stub projector run_me.

With the proper Xtras in the Xtras folder, the training log now runs properly. You will receive an alert letting you know the movie is running with a demo version of Arca, but otherwise the log is fully functioning using the stub projector.

I think it's important to reiterate why you might want to use a stub projector. If you change the movie file, you don't need to rebuild the projector. You can make cross-platform stub projectors and the movie file can be shared between the two. For large projects this can be important. Stubs start quicker because they don't contain media. They aren't necessary for every project, but I generally find they make most projects a bit easier to manage.


The Fast-Start Projector


A fast-start projector is a stub projector taken a step further, to achieve the fastest load times possible. A fast-start projector, or Shockwave projector as I like to call it, is the smallest and fastest-loading projector you can create. If your movie will be run from CD-ROM, a fast-start projector is an especially good option.

Note


Due to many variations in CD-ROM quality even a fast-start projector may take a little while to open on some machines. This is because of CD spin-up time, and in general, the faster the drive the longer the spin-up time.

By setting the Player type to be Shockwave, instead of Standard, the projector is created without the playback libraries packaged into it.

[View full size image]

A stub movie created with the Shockwave option can take as little as 100 Kb of disk space, while the same movie created with the Standard option will take over 2 MB. The difference being the playback libraries.

You projector still needs these libraries for your movie to run, though. When you use the Shockwave option it's assumed the machine used for playback will have the Shockwave player installed. But you can't assume anything about a machine you may never have seen before. Shockwave on the Web is one thing, where the user will be prompted to get the plug-in if they don't have it. But if you're run ning from CD you need a more foolproof method: you must provide the playback libraries yourself. There are four files in Director's root folder that should be copied to your projects root folder.

TIP

The playback library files can be placed in either your projects root folder, or into its Xtras folder. Placing the files in the XTRas folder hides them from the user by one level, keeping the root folder "clean" looking.

The files you need can be found in Director's root folder:


C:\Program Files\Macromedia\Director MX 2004

and on the Macintosh:


OSX Volume Name/Applications/Macromedia/Director MX 2004

Windows

Macintosh

Dirapi.dll

DPLLib

Iml32.dll

IMLLib

msvcrt.dll

MacromediaRuntimeLib

Proj.dll

ProjLib

You now have the basics of the fast-start projectora stub movie created with the Shockwave option. Just be sure to include the playback libraries if you plan on going this route.

Protecting Your Movies


If you'll be distributing your movies, there will come a time when you will want to protect them from prying eyes. If you distribute your source files, anyone with a copy of Director (and that means anyone, since anyone can download a 30-day trial version) can open and examine your code. I recall one commercial game title created in Director that accidentally shipped with all source files. Not one of the movies was protected. I had a lot of fun going through their code and learning what I could.

Depending on your project, sending out the source files to end users could cost you a lot of money, so it's definitely something to avoid. Luckily, Director makes it really easy to convert your source files into protected files that even Director can no longer open.

Let's see how this works by protecting the training log and graph movies.


1.

Navigate to your project_two folder. Within the folder create a new folder named backup.

This new folder will serve to hold the original source files when the protected versions are created. Director won't allow you to create the backups in the same folder as the movies you're protecting, so you must use a separate folder.

2.

Within Director choose Xtras > Update Movies to open the Update Movies Options dialog, as shown here:

Within the dialog you have several options. The Update option allows you to convert older Director movies, from version 5 and greater, to the newest file format. The Protect option removes the data required to edit the movie and changes the movie's extension from .dir to .dxr, and any external cast files extensions from .cst to .cxt. The Convert to Shockwave option lets you batch-convert movies and casts into the compressed Shockwave format.

3.

Choose Protect, then click the Browse button to pick the folder to backup into. Choose the backup folder you just created and click OK in the Update Movies dialog.

Once you click OK, the Choose Files dialog will open. It looks remarkably like the Import Files dialog box:

4.

Select both the graph and mytrainer files, then click the Proceed button.

Once you click Proceed you will get an alert telling you that two files are being protected and where the original files will be stored.

5.

Click the Continue button. After a brief time Director will return.

The graph and mytrainer movies in your project_two folder are now protected and can no longer be edited, or even opened.

6.

Launch the projector file from your project_two folder to verify that the protected files still play properly.

As you can see, there's no difference in playing the protected versions versus the source versions of the movie. But if you try to open a protected file with Director you will receive an error such as the one shown here:

To continue with the rest of this lesson, delete the protected files and move the source files from the backup folder into the main project_two folder.

7.

Close the training log if it's still running, then delete the protected graph and mytrainer files from the project_two folder. Finally, move the two source files from the backup folder into the project_two folder.

Now that you've learned about stub projectors, fast-start projectors and protecting your source files, let's look once again at the Publish Settings and see how you can go about customizing your projector.

Note

Don't forget to back up your source files before using Update to protect them. It seems I read a message every week where someone is asking how they can open their protected files because they either forgot to back up their files, or somehow lost them. Once the files are protected, you won't be able to open them again. You might as well be using Director to try to open and edit MIDI music files.



/ 165