Flash, JavaScript, and lots of Coffee.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Flash, JavaScript, and lots of Coffee.

Post by Gen-ik »

I've been using the Flash JS functions for a while now doing stuff for IE only web apps but now I've decided to include some of the stuff on my own website I have found that Netscape doesn't like the Flash stuff.

Basically you can control Flash from JS using things like var CurrentFrame = flashmovie.CurrentFrame()...... or play a Flash movie with flashmovie.TPlay("_level0/").

NS however doesn't like the commands (which are part of Flash).

I'm just wondering if anyone knows why this is?

Here's a basic example of some code that works in IE but not in NS.

Code: Select all

<head>

<script language="JavaScript">

function PlayFlashFromFrame(frame)
&#123;
    if(document.getElementById!=-1)
    &#123;
        var flash = document.getElementById("flashmovie");
    &#125;
    else if(document.all!=-1)
    &#123;
        var flash = document.all.flashmovie;
    &#125;
    else if(document.layers)
    &#123;
        var flash = document.layers.flashmovie;
    &#125;
    else
    &#123;
        alert("Your Browser IS Rubbush");
        return;
    &#125;

    flash.TGotoFrame("_level5/", frame);
    flash.TPlay("_level5/");
&#125;

</script>

</head>

<body>

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
ID="flashmovie"
WIDTH=780 HEIGHT=140>
 <PARAM NAME=movie VALUE="flash.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FDF7E4> <EMBED src="flash.swf" quality=high bgcolor=#FDF7E4  WIDTH=780 HEIGHT=140 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>

</body>
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

HURRAAAAH!!! Finally got it sorted :D

If you want to have sound effects on your website which are triggered by links, input focus, and anything else you can think of then learn how to communicate with Flash via JS ( http://www.macromedia.com is a good start )....... and you'll be laughing all the way to the land of cool websites.

I'm now happy again.
Post Reply