----- Original Message -----
From: "Evan Adelman" <[EMAIL PROTECTED]>

> <script language="vbscript">
> sub myMovie_ExternalEvent(byVal aCommand)
> if aCommand = "GetJSValue()" then
>   call GetJSValue()
> elseIf aCommand = "TestFunction()" then
>   call TestFunction()
> end if
> end sub
> </script>

I wrote some generic code specifically for Shockwave, but it should work for
Flash too. It's a little bit more elegant than yours, because it is
completely generic. It means that you can call *any* JavaScript function
from the plugin, and VB will automatically call JS. Here it is:

<script language="VBScript">
// This assumes the ID of the shockwave movie is "swObj"
Sub swObj_externalEvent(aParam)
  Eval(aParam)
end sub
</script>

Then, write your main code in JavaScript. if you have something like this as
your JavaScript:

<script language="JavaScript">
function SaySomething(msg)
{
 alert(msg);
}
</script>

You call this from Director:

on mouseUp
  ExternalEvent("SaySomething("&QUOTE&"Hello, World"&QUOTE&")")
end

It's important that you use the above method to insert quotes: you cannot
use single quote characters because VBScript won't recognise them, even
though it will execute JavaScript functions. As long as you keep to this
format it will work properly in both IE on the PC and Netscape 4.

Finally, a short note about browser compatability:

Firstly, the embed tag must included the parameter: swLiveconnect="true" or
it will not work in Netscape 4. It will not work in Netscape 6 because they
have removed LiveConnect, which is required for a plugin to communicate with
the browser. It will not work in IE on the Mac either, because IE uses
ActiveX instead of LiveConnect, and ActiveX is not implemented on the Mac.

- Robert

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to