Articles Archive
Articles Search
Director Wiki
 

Controlling the Shockwave Remote

August 8, 1999
by Zac Belado

With the release of Shockwave 7.02 and the new Shockwave Remote, many developers might be wondering what options they have to control the appearance of the Remote and its ability to save Shockwave files locally.

The Shockwave Remote can be controlled either through HTML or through Director. If you want to modify the Remotes's attributes using HTML, you do so by adding, or modifying, elements of the swRemote parameter in the Embed and Object tags that you use to place your Shockwave content in a web page. The swRemote parameter can have up to 7 different elements but we will only need to look at two; swTarget and swSaveEnabled.

swTarget

swTarget controls whether the Shockwave file becomes the target of the Shockwave Remote. Or, to put it another way, it controls whether the Remote appears when a movie is loaded. By default (unless the user has configured their Remote differently) the Remote will appear whenever the user's browser loads any Shockwave content. Note that Flash content will not trigger the Remote by default.

The swTarget element is added to either an Embed or Object tag (or both, as most developers typically use both tags) and by setting its target value to True or False, you can control the Remote's appearance. If you don't want the Remote to display then you simply need to make the target value False. Conversely, setting it to True will ensure that the Remote appears. Note If the user disables the "Show when encountering Shockwave content" setting in his/her Shockwave Settings (via the Remote's pop-up menu) then enabling the swTarget value will not show the remote.

Embed tag

Unlike Object tags (see below), and most other tags, the Embed tag contains all its parameters inside the first tag of the tag pair and not between the opening and closing tags.

<embed src="yourfile.dcr" 
pluginspage="http://www.macromedia.com/shockwave/download/" 
type="application/x-director" width="400" height="300"></embed>

To add the swRemote parameter (and then add the swTarget value) you simply need to add it inside this first tag of the tag pair.

<embed src="yourfile.dcr" 
pluginspage="http://www.macromedia.com/shockwave/download/" 
type="application/x-director" width="400" height="300" 
swRemote="swTarget='false'"></embed>

Note that the parameter has two parts. Unlike width or type, swRemote has an element (swTarget) and that element's value (in this case false). The swTarget value ('false', in this example) has to be inside a pair of single quotes.

Object tag

The Object tag stores parameters as separate PARAM elements within the Object tag pair. Each parameter is a separate tag. So if you have an existing Object tag like this...

<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" 
codebase="http://active.macromedia.com/director/cabs/sw.cab#version=6,0,1,0" 
width="400" height="300">
<param name="SRC" value="yourfile.dcr">
</object>

...you simply need to add a new PARAM tag that contains the swRemote settings. Unlike the format for use in the Embed tag, the PARAM tag has name and value elements that need to be added separately. So to disable the remote in your Object tag you would need to add

<param name="swRemote" value="swTarget='false'">

Full example

This example shows the Object and Embed tags properly configured so the Shockwave Remote will not appear when the movie is loaded.

<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" 
codebase="http://active.macromedia.com/director/cabs/sw.cab#version=6,0,1,0" 
width="400" height="300">
<param name="SRC" value="yourfile.dcr">
<param name="swRemote" value="swTarget='false'">
<embed src="yourfile.dcr" 
pluginspage="http://www.macromedia.com/shockwave/download/" 
type="application/x-director" width="400" height="300" 
swRemote="swTarget='false'"> 
</embed>
</object>

swSaveEnabled

In order to enable or disable the users' ability to save your Shockwave files to their local drive you need to modify the value of the swsaveEnabled element.

By default the Remote will not save Shockwave content to the user's local drive. In order to allow users the option of doing this, you must enable the Remote's Save feature either via HTML (using parameters in the Embed and Object tags) or in the Shockwave movie using Lingo.

HTML Options

Embed tag

As with the swTarget element, the swSaveEnable element is added inside the Embed tag as an element of the swRemote parameter.

swRemote ="swSaveEnabled='True'"

Object tag

And again, as with the swTarget element the swSaveEnabled element is added as a param tag inside the Object tag.

<param name="swRemote" value = "swSaveEnabled='True'">

Full Example

This example shows the Object and embed tags declared so that local saving is enabled.

<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" 
codebase="http://active.macromedia.com/director/cabs/sw.cab#version=6,0,1,0" 
width="400" height="300">
<param name="SRC" value="yourfile.dcr">
<param name="swRemote" value="swSaveEnabled='True'">
<embed src="yourfile.dcr" 
pluginspage="http://www.macromedia.com/shockwave/download/" 
type="application/x-director" width="400" height="300" 
swRemote ="swSaveEnabled='True'">
</embed>
</object>

You can also combine the elements so you can disable the Remote and enable local saving in the same set of tags. All you need to do is add another element to the swRemote parameter. So if you start with the swTarget element...

swRemote="swTarget='false'"

...all you need to do is add the swSaveEnabled element after the swTarget declaration.

swRemote="swTarget='false' swSaveEnabled='True'"

The PARAM tags for the Object tag follow a similar route. If you start with your basic PARAM tag...

<param name="swRemote" value="swTarget='false'">

...all you need to do is add the second element (in this case swSaveEnabled) after the first

<param name="swRemote" value="swTarget='false' swSaveEnabled='True'">

Note that both values (True and False) need to be enclosed by single quotes.

If you want to increase the legibility of your code you can also add each element as its own element.

swRemote = "swTarget='false'"
swRemote = "swSaveEnabled='True'"

or

<param name="swRemote" value="swTarget='false'">
<param name="swRemote" value=" swSaveEnabled='True'">

Director Options

You can not use Lingo to control the appearance of the Remote. This can inly be done via HTML. You can, though, determine whether the user can save your Shockwave content locally. Within Director, you have two options that will allow you to enable or disable the local save option.

Movie Playback

Director 7 has a Playback options dialog. It is accessed via the Modify: Movie: Playback menu. There are 6 Shockwave Remote options at the bottom of the dialog, all of which are enabled by default. To enable (or disable) local saving of your files select (or deselect) the Save Local check box.

the allowSaveLocal

Director 7 also added a new movie property that you can set to enable or disable local saving.

set the allowSaveLocal = FALSE

This has the same effect as the Save Local and swSaveEnabled parameters. Simply add the declarion to your startMovie or prepareMovie handler (although you could declare it anywhere).

Precedence

The order of precedence for local save settings is:

  1. the allowSaveLocal (Director Lingo)
  2. Save Local (Director Movie Playback Settings)
  3. swSaveEnabled (html Object/Embed tags)

So the allowSaveLocal movie property will supercede both the swSaveEnabled and the Save Local settings, but only as long as the swSaveEnabled value is TRUE in the HTML file that is displaying the Shockwwave file.

This means that you can still turn off local saving from inside your Shockwave movie but you can not enable it if the swSaveEnabled param is FALSE. This also holds true if the param is not defined...since the default value is False, it will not let you override it via the settings in your Shockwave movie.

Summing up

As you can see there are numerous, simple, ways to control the Shockwave Remote and the Remote's ability to save Shockwave content. If you use Dreamweaver 2 you can make this process even simpler by modifying the Shockwave object in Dreamweaver so that it has default settings for the swTarget and swSaveEnabled elements. I've provided a version of the file for download (ZIP).

Simply replace your existing Shockwave object (in the Configuration: Objects: Common directory) with this new file. The swTarget and swSaveEnabled elements have both been set to false in this version of the Shockwave object.

Warning: Before you do replace your current file make sure you back it up. While this file has been tested on my Mac and PC it is always a good idea to back your old version up. You have been warned.

As an added bonus, the Mac download also includes three AppleScripts submitted by Andrew White.

All three scripts have been saved as AppleScript run-only scripts using OS 8.6. If you have any problems with them please contact me as Andrew sent me scripts which I then created run-only versions of...if they don't work on your system it is probably something I did and not Andrew's fault at all.

Zac Belado is a programmer, web developer and rehabilitated ex-designer based in Vancouver, British Columbia. He currently works as an Application Developer for a Vancouver software company. His primary focus is web applications built using ColdFusion. He has been involved in multimedia and web-based development, producing work for clients such as Levi Straus, Motorola and Adobe Systems. As well, he has written for the Macromedia Users Journal and been a featured speaker at the Macromedia Users Convention.

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