Brainiac Source Code
by Frank Coleman

THE BRAINIAC INTERACTIVE PRESS KIT is a fairly simple Macromedia Director/Shockwave application with a menu that leads to one of four different scenes, each of which contains an embedded QuickTime movie clip. Each scene contains a simple lingo script at the loop that tests to see if the movie's complete running time has been reached. Once the clip is over, the program drops us back to the main menu. The ever-present left-hand menu lets you jump from clip to clip at any time, invoking the signature Brainiac gong sound on each click. A piece of cake, really.

This program ran fine off a hard drive or CD-ROM for years, but QuickTime implementation in Shockwave always seemed like more trouble than it was worth, especially for the end user. In 2003, however, technology had finally evolved to the point where I felt it might be easier to pursuade folks to give it a try. I had a bit of trouble getting the movies to play properly off the server at first, and the documentation on Macromedia's site is woefully in need of an update.

It seems like I've solved a lot of the problems, and I wanted to post the results for the benefit of future generations. ;)


Click here to see a screen shot of the Director score.
 
 

Click here to see a clickable map of all the major code pieces.

Summary:

Don't bother with preloadnetthing, netdone, percentstreamed, setting the URL or the filename of cast, etc. None of it -- it needlessly complicates things that QT and SW can sort out by themselves. Just stick the darn QT movie in the score, give it plenty of frames to get a running start and test for the duration of sprite instead of movierate for the loop script in order to test if it's playing or not.

Here's the frame script:

on exitFrame me
global gMovieSprite, gMovieDuration, gMovieTime
gMovieDuration = (the duration of sprite gMovieSprite - 1)
gMovieTime = the movietime of sprite gMovieSprite
if gMovieTime < gMovieDuration then
go the frame -1
end if
end

For the QuickTime cast member properties, use these settings:
Streaming ON
Paused OFF
Direct to Stage ON
Controller ON (this gives the user all the streaming feedback they need -- at least, for this project!)
Preload OFF

Use the Shockwave Default publishing settings. Some of the others seem to be problematic (i.e. won't play). Use separate doorway pages and sniffers in javascript to sort out the people who don't have the player or up-to-date plugins.

When testing the application in a browser while runinng off a local drive, the local folder needs to be specifically named "dswmedia," or it won't work. It's definitely recommended to keep everything in the same folder for simplicity's sake. Less problem resolving paths that way. However, when you're ready to go online, just stick everything in the same folder on your server. You can name that folder whatever you want.

I always welcome questions or ideas for enhancements or better workarounds for the code. Feel free to drop me an e-mail.


Return to the BRAINIAC INTERACTIVE PRESS KIT