Articles Archive
Articles Search
Director Wiki
 

Using Director 8 Features in a Shockwave 7 World

October 17, 2001
by Colin Holgate

As time goes on it's less and less important to remain compatible with Shockwave 7, but often it's fairly easy to be compatible, so why not do it?

One useful thing about Director 8 and 8.5 syntax is that it's completely valid in Director 7. That seems impossible, but let's look at some examples. Try this as a movie script in Director 7:

on awkwardtest

  member (1).image = member (2).image
  sound (1).queue ([member: member "some sound", #rateshift: 4])

end

Of course, if you ever called the handler it would complain bitterly, but it's valid syntax as far as the compiler is concerned. For all we know, member 1 may have a custom property of image, and sound may be your own custom object that has a queue function in it.

What this allows you to do is author in Director 7 and include Director 8 features, but include a test to see if we're in Shockwave 8 before calling the Director 8 specific abilities. Here's a sound example:

on setsoundvalues soundchan,distance,horizontalLoc

  -- make the sound be quieter the further away it is
  sound (soundchan).volume = max (0,min (255, 1000 - abs (distance)))
  -- if we're in SW8, set the pan for the sound
  if version >= 8 then sound (soundchan).pan = (horizontalLoc - 320) / 3

end

SW7 users will get the volume changes, and SW8 users will get the pan as well, even though the movie is authored in Director 7. [Editor's Note: My PS2VS Xtra uses this technique to maintain compatibility with both D7 and D8, while importing multi-curve vector shapes in D8.]

Sometimes you have to go to more trouble than a quick version test. In one movie I did, I had to use 300 sprites in order to get the same effect in Director 7 that I could do in one sprite using Imaging Lingo, but doing that did allow me to present the client with a project that would work well enough for most of their Web site visitors, yet would work much more quickly for users who already had Shockwave 8 installed.

"Oh no! I accidentally Saved the movie in Director 8, deleted my Director 7 files (because I'm a masochist) and my client will cancel the $1M payment if I don't ship the Director 7 files in the next ten minutes!"

We see pleas like this on e-mail list from time to time. The answer is always "too bad". The rest of this short article will dispute that answer. But first, a disclaimer:

The tips shown below are not official in any way. No matter what happens to you or your files, it isn't my fault, or Director Online's, or Macromedia's. The techniques are not tested or supported by anyone, nor will anything be fixed if the tips don't work out for you.

The person that I got the information from, after many hours of torture, is now in Siberia, working in the salt mines. There is no way to contact the person for clarification, partly due to the tongue removal during torture hour 3.

I'll describe this for Macintosh users. Windows users should be able to do the same thing using a Windows-based hex editor, and can skip the Type and Creator stages.

How does the Mac know which application to open?

We all know, I think, that Windows uses a file name extension to identify the file format, and that in the case of documents the system knows which application will handle that type of document. Director files have a file extension of DIR, and double-clicking on such a file will probably open the latest version of Director installed on your machine.

On a Mac, a file has a Type and Creator identifier, which is different for each version of Director. Those two values help the system figure out what to do with the file. You can drag a file of Type MV07, MV08, and MV85 onto Director 8.5 and it will highlight (suggesting that it will happily open the file). Dragging a MV08 file onto Director 7 won't do anything for you, because the system can tell that Director 7 has never heard of a MV08 file.

The Creator codes for Director are MD00 for D7, MD01 for D8, and MD03 for D8.5. This does suggest that at one point there was a MD02. Who knows what version that would have been!

You would think then that if you take a Director 8 document and change its Type from MV08 to MV07, and its Creator from MD01 to MD00, you would be able to double-click on it, and Director 7 would open. Well, it does! Try it for yourself, using something like ResEdit to set the Type and Creator for the file.

Many of us excitedly tried this soon after getting Director 8, thinking that we could develop using Director 8's environment, and still deliver to Director 7 users. We discovered (as have you did if you tried the Type and Creator changes) that Director knows that the file is not the right format, and will tell you so as Director tries to open the file.

How Does Director Know Which File Format You've Thrown at it?

At this point I'll be describing something about which I have no idea what it means, but I do know it works. Deep within the file there are a couple of hexadecimal numbers that Director checks to see what file format it's dealing with. Finding those numbers is the first challenge for you, so dig out your hex editor (I used HexEdit on the Mac; on Windows, you might look at HackMan), make a duplicate of your Director file, and try looking for this:

Those hex characters might appear within the normal data for the file, in the middle of a sound or bitmap for example, so in Director 8, keep looking for that sequence until you see two places soon after that are 06 40 (see the caption for the image below for Director 8.5). Here's an example section of a Director 8 file:

44 52 43 46 00 00 00 54 00 54 06 40 00 90 00 C0
02 70 03 40 00 01 00 62 00 00 12 74 00 00 00 00
00 00 00 FF 00 20 FD 00 00 00 00 00 06 40 00 20
00 00 00 00 00 00 00 00 00 00 00 00 00 32 00 0F

Don't forget that the first four pairs would be 46 43 52 44 if the file had been last saved under Windows. You can see the 06 40 in the first line, and near the end of the third line. Change the 06 40 to be 05 7E in both cases. Save the changes, after being completely sure you have an original copy to go back to in case something has gone wrong. Do the Type and Creator changes, and then double-click on the file (or skip the Type and Creator changes under Windows, and drag the DIR onto your Director 7 shortcut or EXE).

This screen capture is from HexEdit, and shows a Director 8.5 file last saved on a Mac. The black highlight shows the location of the hexadecimal search string. The green highlights show the D8.5 equivalents to the 06 40 sequence in a D8 file. Notice, too, the proximity to the Copyright notice and Font Mapping data in the file, which may help you identify the correct sequence. -- DP

All being well, you should now be in Director 7 looking at your Director 8 DIR file. The wise thing to do at this point would be to do a Save As, just to be certain that the file is Director 7 file format.

Something obvious, but I'll point it out anyway, is don't be so optimistic if you have newer member types in the file. For example, no multiple curve Vectors, or SW3D members. The point of the whole exercise is to recover from having accidentally saved a D7 project under D8. You need to be dead sure that the file should work in Director 7, otherwise who knows what might happen?

What if it Doesn't Work?

Go over your steps carefully, in case you changed the wrong 06 40's (or 07 3As), or something like that. The worst case is that you're no worse than before, and you'll eventually learn not to delete the D7 version of your files!

What if it Does Work?

If it works, and you make that $1M, feel free to give me a commission. I'll make sure that my friend in Siberia gets extra food parcels.

A sample Director 8.5 file and a file converted to open with Director 7 are available in Mac and Windows archives.

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