hey actionscripters-
Working on a site that uses external interface to control the appearence of a number of buttons, setting color and text. The whole deal works fine in Firefox and IE (after vigorous debuggging), but I can’t seem to address the objects correctly in safari. The swfs are hard coded in and I’m using a function to find the reference to the object and then using an EI addcallback to set the values.
Here some javascript for the main functions:
function getMovieName(movieName) {
if (window[movieName]) {
if (window[movieName].id != undefined){
//alert("explorer! window id: "+window[movieName].id);
return window[movieName];
} else {
//alert("safari! window id: "+x.id);
x = window[movieName];
return x;
}
}
else if (document[movieName]){
//alert("firefox! document id: "+document[movieName].id);
return document[movieName];
}
else {
alert("other");
}
}
function setSwfColor(){
var color = "<?php echo $skinColor; ?>";
var headerTxt = "<?php echo $headerTxt; ?>";
getMovieName("headerSwf").setBtn(color,headerTxt);
getMovieName("btnSwf1").setBtn(color,"Home",false,"index.php?page=home");
getMovieName("btnSwf2").setBtn(color,"Learn More",false,"index.php?page=learn");
getMovieName("btnSwf3").setBtn(color,"Why Turn Key?",false,"index.php?page=why");
getMovieName("btnSwf4").setBtn(color,"Who Is <?php echo $firstName; ?>?",false,"index.php?page=about");
getMovieName("btnSwf5").setBtn(color,"myBiz News",true,"index.php?page=news");
getMovieName("signUpSwf").setBtn(color);
//alert("header set");
getMovieName("arrowSwf").setBtn(color,"Take The Tour","<?php echo $mibLink;?>");
}
Here’s an example of one of the flash objects:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="764" HEIGHT="146" id="headerSwf">
<PARAM NAME=movie VALUE="<?php echo $baseHref; ?>flash/dynoHeader.swf">
<param name=’allowScriptAccess’ value=’always’/>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="<?php echo $baseHref; ?>flash/dynoHeader.swf" quality=high bgcolor=#FFFFFF WIDTH="764" HEIGHT="146" NAME="headerSwf" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />
</OBJECT>
This is what I’m on currently but I’ve tried everything I can think of to reference the object in the safari fork of getMovieName (document.getElementById, window[movieName], etc) but no luck! Currently safari error consol reads “Value undefined (result of expression getMovieName(“headerSwf”).setBtn) is not object.” I’m no javascript wizard, but I know enough to get by 95% of the time. What am I doing wrong here? Any help will be very much appreciated!