Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: FLASH: Transperance... |
From: | Nigel Randsley-Pena |
Date: | Wed, 26 Aug 1998 01:23:46 +0100 |
Sorry to send this to the list but I promised Peter I would get it to
him and the e-mails I send to him bounce back.
<!-- Cut below
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Javascript and Flash Sample - per request of Peter
Andrén</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide JavaScript
// function Is() based on Netscape's Ultimate Client-Side Sniffer
// (C) Netscape Communications 1998. Permission granted to reuse and
distribute.
function Is ()
{ // convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
// *** BROWSER VERSION ***
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.nav = ((agt.indexOf('mozilla')!=-1) &&
((agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1)));
this.nav2 = (this.nav && (this.major == 2));
this.nav3 = (this.nav && (this.major == 3));
this.nav4 = (this.nav && (this.major == 4));
this.nav4up = this.nav && (this.major >= 4);
this.navonly = (this.nav && (agt.indexOf(";nav") != -1));
this.ie = (agt.indexOf("msie") != -1);
this.ie3 = (this.ie && (this.major == 2));
this.ie4 = (this.ie && (this.major == 4));
this.ie4up = this.ie && (this.major >= 4);
this.opera = (agt.indexOf("opera") != -1);
// *** JAVASCRIPT VERSION CHECK ***
// Useful to workaround Nav3 bug in which Nav3
// loads <SCRIPT LANGUAGE="JavaScript1.2">.
if (this.nav2 || this.ie3) this.js = 1.0;
else if (this.nav3 || this.opera) this.js = 1.1;
else if ((this.nav4 && (this.minor < 4.06)) || this.ie4) this.js =
1.2;
// NOTE: In the future, update this code when newer versions of JS
// are released. For now, we try to provide some upward
compatibility
// so that future versions of IE will show they are at *least* JS
1.2
// capable and all future versions of Nav at *least* JS 1.3 capable.
// Always check for JS version compatibility with > or >=.
else if (this.nav && (this.minor > 4.05)) this.js = 1.3 ;
else if (this.ie4up) this.js = 1.2;
else this.js = 0.0; // HACK: always check for JS version with > or
>=
// Not used here but included because it might come in handy.
}
var is = new Is();
// function Start() and following JavaScript
// (C) RedStar 1998. Reuse and distribute freely
function Start ()
{
var time = new Date();
var hour = time.getHours();
// Using named colours but could use also RGB.
// Notice the hack used later to convert named to RGB
BGColours = new
Array("Black","Navy","Blue","SlateBlue","DarkBlue","Indigo","Purple","DarkGreen","AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","BlanchedAlmond","MistyRose","Moccasin","NavajoWhite","OldLace","DarkOliveGreen","DarkRed","FireBrick","MidnightBlue");
this.BGColour = BGColours[hour];
// Now let's set Text colour to be readable.
// For a really disgusting look try setting FGColour to 0xFFFFFF -
BGColour
if ( hour > 7 && hour < 19 )
this.FGColour = "Black"
else
this.FGColour = "White";
}
var start = new Start();
//document.bgColor = this.BGColour;
//document.fgColor = this.FGColour;
// --> end Hide JavaScript
</SCRIPT>
</HEAD>
<!-- Look Ma no BODY! (don't try this at home kids) -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide it
// this will take care of the background and text colours
document.bgColor=start.BGColour;
document.fgColor=start.FGColour;
//--> ok stop hiding it
</SCRIPT>
<!-- Ok now we want Flash movie with background tranparent or at *least*
same colour as pages background colour -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide it. Yes again
if ( is.ie ) // object first
{
// Don't forget to adjust the values to what you need
document.write('<OBJECT ID="movie"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0,0"
width="50%" height="50%"><BR>');
document.write('<PARAM NAME="Movie" value="movie2.swf"><BR>');
document.write('<PARAM NAME="Quality" VALUE="High"><BR>');
document.write('<PARAM NAME="Loop" VALUE="True"><BR>');
document.write('<PARAM NAME="Play" VALUE="True"><BR>');
if ( is.ie4 || is.ie4up ) // use WMODE
document.write('<PARAM NAME="WMODE" VALUE = "transparent"><BR>');
else
// see next comment. BGCOLOR is RGB and not named colour
document.write('<PARAM NAME="BGCOLOR" VALUE=' + document.bgColor +
'><BR>');
document.write("</OBJECT>");
}
if ( is.nav ) // embed now
{
document.write('<EMBED src="movie2.swf"
type=application/x-shockwave-flash width="50%" height="50%"
Quality="high" Play="True" loop="True" swLiveConnect="False"
NAME="movie"');
// now we set the bgcolor. Don't use start.BGColour, get it from
document.bgColor.
// If we use named colours in Flash as argument for BGCOLOR it
wouldn't know what to do
document.write('BGCOLOR="' + document.bgColor + '"');
document.write('PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
document.write("</EMBED>");
}
var col = document.bgColor;
document.write("<BR>");
document.write("Just some text so you can see<BR>");
document.write("that TEXT colour got set<BR>");
document.write("Hope this helps you.<BR>Regards,<BR>Nigel.");
//--> ok stop hidding it
</SCRIPT>
<!-- This is where BODY would end -->
</HTML>
<!-- cut above
------------------------------------------------------------------------
To UNSUBSCRIBE send: unsubscribe flasher in the body of an
email to list-managershocker [dot] com. Problems to: ownershocker [dot] com
N.B. Email address must be the same as the one you used to subscribe.
For info on digest mode send: info flasher to list-managershocker [dot] com
Replies
FLASH: Transperance..., Peter Andr�n
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]