progman1010
Programmer
i have a page which randomly rotates a flash movie after a few seconds. (page: Problem is, that every time the thing rotates, the whole page blinks annoyingly.
What's even crazier is that this does not happen at all on another site. the only thing that's really that different is that this site was originally designed in tables and the other is in all css.
here's the rotator code:
What's even crazier is that this does not happen at all on another site. the only thing that's really that different is that this site was originally designed in tables and the other is in all css.
here's the rotator code:
Code:
//***The following is for the roating flash object
var speed = 6000; // speed of update in miliseconds. 1 sec = 1000 ms.
var flash_id = 'flashme'; //id of the <div> object to manipulate
var root_folder = 'images/flash/';
// array of flash files [filename, width, height]
var swfFiles= new Array()
swfFiles[0]=['banner_completelywebbased.swf', 600, 200 ]; // [filename,width,height]
swfFiles[1]=['banner_fastandeasybilling.swf', 600, 200 ];
swfFiles[2]=['banner_freetechsupport.swf', 600, 200 ];
swfFiles[3]=['banner_mobile.swf', 600, 200 ];
swfFiles[4]=['banner_quickbooksintegration.swf', 600, 200 ];
swfFiles[5]=['banner_realtimereporting.swf', 600, 200 ];
var timer = 0;
var oldnumber = 0;
var randomnumber = 0;
function reload_flash() {
clearTimeout(timer);
while (randomnumber == oldnumber) //don't repeat
randomnumber = Math.floor(Math.random()*swfFiles.length);
oldnumber = randomnumber;
src=root_folder + swfFiles[randomnumber][0];
height=swfFiles[randomnumber][2];
width=swfFiles[randomnumber][1]
document.getElementById(flash_id).innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="[URL unfurl="true"]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"[/URL] width="'+width+'" height="'+height+'" loop="false"><param name="movie" value="'+src+'"> <param name="quality" value="high"> <param name="loop" value="false"> <embed id="flash_rotator" src="'+src+'" quality="high" pluginspage="[URL unfurl="true"]http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"[/URL] type="application/x-shockwave-flash" height="'+height+'" width="'+width+'"></embed></object>';
timer = setTimeout("reload_flash()", speed);
}
</script>
<div id="flashme" style="height: 200px; width: 600px; position: relative;"></div>