js_sw

  javascript / shockwave via external parameter
javascript shockwave




  access to URL string from Shockwave
From:         Christian Wach <chris@flowmotion.demon.co.uk>
Subject:      access to URL string from Shockwave
To:           DIRECT-L@LISTSERV.UARK.EDU

Hi Abram,

>After some cursory research, it looks as though the only way for a shockwave
>movie to see the URL string of the page that it is embeded within is to pass
>the URL in as an external parameter. Am I missing an easier way?

I'm in digest mode, so apologies if you already have a
solution to your problem. You are essentially correct
that SW cannot find its own location... it needs to be
passed to it by javascript.

I use this script (or variations on it) to pass all sorts
of info to shockwave movies that can only be found using
javascript, including the width and height of the page
that a movie sits in (see Al Hospers thread on this a
couple of weeks back: 'stage size in browser').

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!-- Hide

    // Get location string

    nav_loc = String(document.location.href);

    // Write Object and Embed Tag

    document.write('<OBJECT
CLASSID="clsid:166B1BCA-3F9C-11CF-8075-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#
version=7,0,2,0" WIDTH="320" HEIGHT="240"><PARAM NAME="src"
VALUE="your.dcr"><PARAM NAME="SWLIVECONNECT" VALUE="0"><PARAM NAME="sw1"
value="' + nav_loc + '"><EMBED src="your.dcr"
pluginspage="http://www.macromedia.com/shockwave/download/" width="320"
height="240" sw1="' + nav_loc + '"><\/EMBED><\/OBJECT>');

    // End Hide -->
    </SCRIPT>

btw, beware line breaks.

hth,

Christian

Home shock + cgi Bits 'n pieces Director Lingo ShockLets Contact