How to auto-resize ShockWave

Date: Thu Sep  3 08:45:54 MST 1998
From: Peter McBride <pete@otc.net>
Subject: How to auto-resize ShockWave
This was a cool enough hack that I thought I'd share it.

I finally figured out a way to get ShockWave to recognize how big is the frame it is currently in; once you have done that, it isn't too hard to have ShockWave then reconfigure itself for any size frame. For instance, I've written a clock that automatically fills the current frame, no matter how big or small it is.

This requires a little setup in HTML and one really dweeboid line in Director:

  1. Create a GIF "dot.gif" that is 1x1 pixel, with the transparency set to the color of the single pixel. We're doing this so it doesn't appear when we draw it in step 2:

  2. Add the following tag to the very FIRST line after the BODY of the HTML:
      <IMG SRC="dot.gif" WIDTH=100% HEIGHT=1 BORDER=0>< BR >
    
    This will help ShockWave learn how big the frame is. We're gonna use it find out what WIDTH evaluated to.

  3. Add your ShockWave link:
     <embed width=100% height=100% src="myMovie.dir" name="testMovie">
    
    

  4. Now here's the geeky Lingo. Put the following handlers into your shockwave file. The geeky bit is that we're including EvalScript as part of the external event handler; this means that no javascript functions are needed in the HTML document. It just works.
      on whatSize
        externalEvent("parent.document.testMovie.EvalScript(document.images[0].width);")
      end
    
      on EvalScript x
        alert "Window Width is:" && value(x)
      end
    

  5. Add some trigger event to get WhatSize to fire off, such as an exitframe or mouseup...

  6. And there you have it!