Accessibility

Director Article

 

Checking for New Features When Publishing for Shockwave 8.5


Dan Sadowski

Dan Sadowski

www.directordev.com

Created:
22 November 2004
User Level:
Intermediate

When you create movies with Macromedia Director MX 2004, your movies will play back on Shockwave Player 8.5, and in most cases, on earlier versions of the player. However, if you use several new features in Director MX 2004 to create a movie, your movie may be incompatible with earlier versions of the player.

Until now, it was difficult to know which Director MX 2004 features would prove problematic in your movie when publishing to players released prior to 8.5.

For example, with Director MX 2004, you can choose which player version you want to publish to by opening the Version pop-up menu (in the Shockwave tab of the Publish Settings dialog box). If you use the features that are incompatible with older versions of Shockwave Player, a warning dialog box will appear. Unfortunately, this dialog box only warns you, but does not list potential problem areas of your movie.

In this article, I'll show you how to use the Movies-In-A-Window (MIAW) tool to pinpoint problem areas of your movie. The MIAW tool utilizes two new features in Director MX 2004: Display templates and JavaScript.

Requirements

To complete this tutorial you will need to install the following software and files:

Director MX 2004

Sample files, including MIAW tool:

Using the MIAW Tool

To use the MIAW tool, simply download the ZIP file and extract the DIR file from it. Place Check_For_New_Features.dir in the Xtras directory within the configuration directory of your Director MX 2004 installation. When you restart Director, MIAW will appear as a menu item in the Xtras menu. Selecting this item opens the movie as a MIAW, which you can dock with other tool windows if you wish.

Clicking the Check for New Features button invokes the MIAW tool. The tool examines the open movie and prepares a report, which is presented in the text area of the MIAW.

About the scriptExecutionStyle Movie Property

The scriptExecutionStyle movie property was introduced in Director MX 2004. Its Lingo and JavaScript syntax is as follows:

_movie.scriptExecutionStyle

Description

The scriptExecutionStyle movie property controls how certain Lingo expressions are evaluated or how operations perform. By default, the value is 10 for movies created in Director MX 2004 and 9 for movies created in earlier versions. You can test the property's value and set it to something other than the default.

If you are publishing a movie for Shockwave 8.5 playback, set the value of this property to 9. This ensures that Director uses the old Lingo evaluation rules when playing the movie in Director MX 2004.

Note: Setting this property in a script in Shockwave 8.5 will generate an error, so don't assign a value to this property in one of your movie scripts. Instead, simply assign the value to the property in the message window before saving the movie.

Table 1 lists the scripting items that behave differently based on the setting of the scriptExecutionStyle property. A couple of these behaviors were changed after the r188 build of Director MX 2004, as indicated. (The r188 build was used for the initial English release of the product.)

Table 1. Scripts Affected By scriptExecutionStyle Property Settings
Script Affected scriptExecutionStyle<10 scriptExecutionStyle>10
Sending activateWindow or deactivateWindow messages in Shockwave Events are not sent to a movie script Events are sent to a movie script
Order that the openWindow message is sent to a MIAW Message order:
openWindow
prepareMovie
startMovie
activateWindow
Message order:
prepareMovie
startMovie
openWindow
activateWindow
Format of message table for scripting Xtra Errors are ignored Errors are reported to the user
Invalid script object reference:
script("not here")
Error is generated Evaluates to <Void>
Valid named sprite object reference:
sprite("mySprite")
Evaluates to (sprite 1) Evaluates to a sprite reference
Invalid named sprite object reference:
sprite("not here")
Evaluates to (sprite 1) Evaluates to <Void>
Invalid member object reference:
member("not here")
Error is generated Evaluates to <Void>
Invalid castlib object reference:
castlib("not here")
Error is generated Evaluates to <Void>
Invalid script object reference Error is generated Gives void
Reference to missing cast reference by name Error is generated Gives void
Timeout object Any reference to a timeOut object creates a new timeOut object if one doesn't exist A timeOut object is only created by use of the new keyword
Window object reference Any reference to a window object creates a new window object in the windowList if one doesn't exist Window is only created in the windowList by use of the new keyword
Script object version property:
script(1).version
Error is generated Returns 0
Color object string representation:
color(#rgb, red, green, blue)
color(index)
String representation:
rgb(red, green, blue)
paletteIndex(index)
String representation:
color(red, green, blue)
color(index)
Different property names used in these property lists:
the movieXtraList (_movie.xtraList)
the xtraList (_player.xtraList)
[[#name: "INetUrl PPC Xtra"]]
[[#name: "Bitdreader", #version: "10.0"]]
[[#fileName: "INetUrl PPC Xtra"]
[[#fileName: "Bitdreader", #version: "10.0"]]
the windowList Stage window does not appear in the windowList Stage window appears in the windowList
Converting a Flash value of undefined to a Director value Value is converted to null
(in build r188 this is returned as 0)
Value is converted to void
Passing a void value to a method of a Flash object Value is passed as the number 0 Value is passed as undefined
(in build r188 this value is always passed as 0)
Setting a property of a Flash object to void Value is passed as the number 0
(in build r188 this assignment gets a script error after completing the assignment)
Value is passed as undefined
(in build r188 this assignment gets a script error)

Features Checked for Compatibility

The following areas are checked by the MIAW tool. Each check, except the Lingo script analysis, is completed when you publish a movie for Shockwave 8.5 playback:

  • New member types not supported in 8.5: Flash component, Version 7 SWF files, DVD, Windows Media Player, script members with JavaScript syntax.
  • _movie.scriptExecutionStyle value > 9: Although this value is ignored by the Shockwave 8.5 playback code, setting this value to 10 might hide some problems from appearing when you play the movie in Director MX 2004.
  • Channel names: Although just having a channel name will not cause a playback problem in Shockwave 8.5, a channel name being referenced by a script won't work.
  • Sprite names: Although just having a sprite name will not cause a playback problem, referencing a sprite name by a script won't work as expected.
  • Analyze scripts: Scripts that use Lingo syntax to look for constructs may not work properly. This is done using a JavaScript handler and regular expression pattern matching of strings. The following situations are checked for:

    • Use of "sprite" followed by a quoted expression
    • Use of "sendSprite" followed by a quoted expression
    • Use of scriptExecutionStyle
    • Use of _system, _player, _global, or _movie keywords

Implementation Details About the MIAW Tool

This MIAW tool uses Display template settings, which allow it to behave like other authoring tool windows. Using the Display Template tab in the Property inspector, I set the Type of the window to Tool rather than Document when I created the MIAW tool. I also selected the Docking option to allow the MIAW to dock with built-in tool windows such as the Text Inspector.

The movie uses the JavaScript regular expression pattern-matching feature to search Lingo script members for code that uses features. This may cause problems when running in Shockwave 8.5. The movie does not check for every possible problem but it does check for common sources of errors.

Unlike checking member types, this analysis is not made when publishing a DCR for Shockwave 8.5. It is possible that some valid code can be flagged by this type of syntax check—for example, if you happen to have a variable named _movie in your script.

You can find the patterns defined in the Pattern Match script member. The following code constructs are checked:

  • Use of _system keyword
  • Use of _player keyword
  • Use of _movie keyword
  • Use of _global keyword
  • Use of scriptExecutionStyle property
  • Use of quoted strings with sprite and sendSprite expressions

When the MIAW tool isn't actively analyzing the main movie, the frame rate is 1 fps so the MIAW won't interfere with other tasks. When the analysis starts, the frame rate is increased so the process completes itself as quickly as possible.

The "report" and "status" fields in the MIAW resize when the window changes size. This was easy to do by responding to a resizeWindow event. Unfortunately, if the MIAW is docked with another tool window, the window size may change without a resizeWindow event being forwarded to the MIAW. As a workaround to this behavior, the MIAW uses an exitFrame check to see whether the window has changed size.

The MIAW tool operates using a state machine style of programming. This is managed in the Analyze behavior script. Because the code examines every sprite, cast member, and line of Lingo script in the movie, the analysis can take a very long time for large or complicated movies. Rather than checking the entire movie in one shot when you click the button, the MIAW starts a process. I have included an Interrupt button in case you want to stop the analysis before it is done.

About the author

Dan Sadowski has been involved with Macromedia since 1984 when the company was called MacroMind. He works out of his home in Colorado Springs, Colorado, as a software engineer for the Director development team.