Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | RE: FLASH: gif in stead of swf file |
From: | Eric Dunham |
Date: | Fri, 21 Jan 2000 05:27:15 GMT |
*NB: This is only if you're using JavaScript as a Flash detection device.
----------------------------------------------------
<script src="FlashDetect.js">
<script>
<!--
//I'm assuming that you have all of your
//Flash detection code in an external file
//name FlashDetect.js in the same directory
//as the HTML page.
//Otherwise change it as necessary.
//On to the example:
//What you need to do in your detection script
//is have some variable called "gotFlash"
//that will be a boolean variable
//and of course, it needs to be true if flash is detected
//and (duh) false if flash is not detected.
//the following functions help out with some of the code at the bottom
//the first function below defines all the code for embedding an SWF in a
page
//the second function below defines all the code for placing an image in a
page (with a border of 0)
function Flash()
{
//function prototype:
//Flash(version, filename, width, height, bgcolor, quality, loop, play,
id);
//Notes:
//version does not have to be in double quotes because it's only a single
number (3, 4, etc.)
//filename - you do have to put the ".swf" when you specify the name.
//width and height do not have to be in double quotes ONLY if you are using
fixed numeric values
//bgcolor does not require the leading "#" symbol
//loop and play are both boolean variables that will be set to either true
or false, but you must still specify "true" or "false" in double quotes
//If you want to change any of this code, go ahead...
//You could make some of the arguments optional, you could make it easier,
whatever...
//I wrote this in about 5 minutes so that I could try and help someone, so
please don't criticize my coding
//I'm also tired and hungry and I have to be at work very early :)
//All that aside...
//sample function call:
//Flash("4","MyMovie.swf","100%","100%","ffffff","best","true","true","MyMov
ie");
FlashParams = Flash.arguments;
FlashLength = Flash.arguments.length;
FlashObject = "<object
classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \n";
FlashObject +=
"codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version="
+FlashParams[0]+ ",0,0,0\" \n";
FlashObject += "id=\"" +FlashParams[8]+ "\" ";
FlashObject += "width=\"" +FlashParams[2]+ "\" height=\"" +FlashParams[3]+
"\">\n";
FlashObject += "<param name=\"Movie\" value=\"" +FlashParams[1]+
"\">\n";
FlashObject += "<param name=\"BGColor\" value=\"#" +FlashParams[4]+
"\">\n";
FlashObject += "<param name=\"Quality\" value=\"" +FlashParams[5]+
"\">\n";
FlashObject += "<param name=\"Loop\" value=\"" +FlashParams[6]+
"\">\n";
FlashObject += "<param name=\"Play\" value=\"" +FlashParams[7]+
"\">\n";
FlashObject += "<embed src=\"" +FlashParams[1]+ "\"
type=application/x-shockwave-flash \n";
FlashObject += "width=\"" +FlashParams[2]+ "\" height=\"" +FlashParams[3]+
"\" ";
FlashObject += "bgcolor=\"#" +FlashParams[4]+ "\" \n";
FlashObject += "Quality=\"" +FlashParams[5]+ "\" ";
FlashObject += "Loop=\"" +FlashParams[6]+ "\" \n";
FlashObject += "Play=\"" +FlashParams[7]+ "\" ";
FlashObject +=
"pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Pro
d_Version=ShockwaveFlash\">\n";
FlashObject += "</embed>\n</object>\n";
return FlashObject;
}
function Img(filename)
{
//this follows the same naming convention as above (ie. you must include
the extension with the filename)
ImgObject = "<img src=\"" +filename+ "\" border=0>";
return ImgObject;
}
//now here is the magic line of code that does everything that you want to
do (I hope)
gotFlash?
document.write(Flash("4","MyMovie.swf","100%","100%","ffffff","best","true",
"true","MyMovie")) : document.write(Img("MyMovie.jpg"));
//-->
</script>
----------------------------------------------------
That's it...just one line of code. Now you do have to understand that doing
links and etc. would be quite easy as well if the image was what got
displayed. If you understand what I just did, then you should easily be able
to add in the code to do that, and if you can't, then I'll be more than
happy to help. Also you might need to know that you don't even have to put
anything in the body tags at all (unless you want something else there).
You could simply have your script tags at the top of the document in your
head section and then have empty body tags and it should all still show up
fine.
Or you could just as well put the script tags in the body tags, or anywhere
else for that matter. Ok, now I'm just getting sleepy. Let me know if the
code doesn't work (I didn't test it, I just wrote it. Bad me, I know :)
HTH,
Eric Dunham
<clip>
On my startpage I've a swf file as button to a flashpage. How do I show a
gif file in stead of the swf file when a viewer has no flash plugin. Is
there a script for that ?
</clip>
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Streaming Media WEST '99 Conference & Exhibition
"The Worlds largest Internet Audio & Video Event"
December 7 - 9, San Jose Convention Center, California
Reserve your space today at http://www.streamingmedia.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpchinwag [dot] com
Replies
RE:FLASH: gif in stead of swf file, MPL Christopher Jester
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]