The key reason I moved the code to a function and called it onLoad was so the flash is displayed once the page is loaded. My current problem is if the flash loads first, the animation starts before the surrounding graphics have loaded. The method you've given me (although it appears to have a more robust and comprehensive detection function) still requires it's own code in the body for each flash movie (more than 1 movie per page and you've duplicated the code) and is loaded as soon as the browser parses the page.
Is there no explanation as to why the "var plugin = ...." ceases to work when moved into a function?
Cheers for the feedback so far...
Main Topics
Browse All Topics





by: ryancysPosted on 2003-09-23 at 03:57:13ID: 9411847
Try add these code:
xOf("MSIE" ) != -1) ? true : false; // true if we're on ie xOf("Windo ws") != -1) ? true : false; // true if we're on windows
alled = (IsObject(CreateObject("Sh ockwaveFla sh.Shockwa veFlash.2" ))) \n'); alled = (IsObject(CreateObject("Sh ockwaveFla sh.Shockwa veFlash.3" ))) \n'); alled = (IsObject(CreateObject("Sh ockwaveFla sh.Shockwa veFlash.4" ))) \n'); alled = (IsObject(CreateObject("Sh ockwaveFla sh.Shockwa veFlash.5" ))) \n'); alled = (IsObject(CreateObject("Sh ockwaveFla sh.Shockwa veFlash.6" ))) \n');
ave Flash 2.0"] ve Flash"]) {
ve Flash 2.0"] ? " 2.0" : ""; ve Flash" + isVersion2].description;
charAt(fla shDescript ion.indexO f(".") - 1));
exOf("WebT V") != -1) actualVersion = 3;
ashPage);
ctualVersi on >= 2) ? upgradePage : noFlashPage);
script>
6D-11cf-96 B8-4445535 40000"' .macromedi a.com/pub/ shockwave/ cabs/flash / swflash.c ab">' .swf">' wave-flash "' acromedia. com/shockw ave/downlo ad/index.c gi? P1_Prod _Version=S hockwaveFl ash">'
ntent); // insert non-flash content
detector.js:
var requiredVersion = 5; // Version the user needs to view site (max 6, min 2)
var useRedirect = false; // Flag indicating whether or not to load a separate
// page based on detection results. Set to true to
// load a separate page. Set to false to embed the
// movie or alternate html directly into this page.
// *************
// Everything below this point is internal until after the BODY tag.
// Do not modify! Proceed to the BODY tag for further instructions.
// *************
// System globals
var flash2Installed = false; // boolean. true if flash 2 is installed
var flash3Installed = false; // boolean. true if flash 3 is installed
var flash4Installed = false; // boolean. true if flash 4 is installed
var flash5Installed = false; // boolean. true if flash 5 is installed
var flash6Installed = false; // boolean. true if flash 6 is installed
var maxVersion = 6; // highest version we can actually detect
var actualVersion = 0; // version the user really has
var hasRightVersion = false; // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0; // the version of javascript supported
// Check the browser
var isIE = (navigator.appVersion.inde
var isWin = (navigator.appVersion.inde
jsVersion = 1.1;
if(isIE && isWin){
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
document.write('on error resume next \n');
document.write('flash2Inst
document.write('flash3Inst
document.write('flash4Inst
document.write('flash5Inst
document.write('flash6Inst
document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}
function detectFlash() {
if (navigator.plugins) {
if (navigator.plugins["Shockw
|| navigator.plugins["Shockwa
var isVersion2 = navigator.plugins["Shockwa
var flashDescription = navigator.plugins["Shockwa
var flashVersion = parseInt(flashDescription.
flash2Installed = flashVersion == 2;
flash3Installed = flashVersion == 3;
flash4Installed = flashVersion == 4;
flash5Installed = flashVersion == 5;
flash6Installed = flashVersion >= 6;
}
}
// Loop through all versions we're checking, and
// set actualVersion to highest detected version.
for (var i = 2; i <= maxVersion; i++) {
if (eval("flash" + i + "Installed") == true) actualVersion = i;
}
if(navigator.userAgent.ind
if (actualVersion >= requiredVersion) {
if (useRedirect) {
if(jsVersion > 1.0) {
window.location.replace(fl
} else {
window.location = flashPage;
}
}
hasRightVersion = true;
} else {
// The user doesn't have a new enough version.
// If the redirection option is on, load the appropriate alternate page.
if (useRedirect) {
// Do the same .replace() call only if js1.1+ is available.
if(jsVersion > 1.0) {
window.location.replace((a
} else {
window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
}
}
}
}
detectFlash();
then in your page, try add:
<script language="Javascript1.2" src="../js/detector.js"></
<Script language = "Javascript">
if (!useRedirect) { // if dynamic embedding is turned on
if(hasRightVersion) { // if we've detected an acceptable version
var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE
+ 'WIDTH="282" HEIGHT="174"'
+ 'CODEBASE="http://download
+ '<PARAM NAME="MOVIE" VALUE="images/side_company
+ '<PARAM NAME="PLAY" VALUE="true">'
+ '<PARAM NAME="LOOP" VALUE="false">'
+ '<PARAM NAME="QUALITY" VALUE="high">'
+ '<PARAM NAME="MENU" VALUE="false">'
+ '<EMBED SRC="images/play.swf"'
+ 'WIDTH="282" HEIGHT="174"'
+ 'PLAY="true"'
+ 'LOOP="false"'
+ 'QUALITY="high"'
+ 'MENU="false"'
+ 'TYPE="application/x-shock
+ 'PLUGINSPAGE="http://www.m
+ '</EMBED>'
+ '</OBJECT>';
document.write(oeTags); // embed the flash movie
} else {
var alternateContent = '<IMG SRC="images/pix_com.jpg">'
// + '<BR>any desired alternate html code goes here';
document.write(alternateCo
}
}
</script>