Hello,
I'm trying to get scripts that will enable me rotate flash movies every time a page is loaded in essence i have various flash movies and i want different ones to be displayed anytime the page loads.
Thanks
Hello,
I'm trying to get scripts that will enable me rotate flash movies every time a page is loaded in essence i have various flash movies and i want different ones to be displayed anytime the page loads.
Thanks
A simple way to show a different movie on every load is to pick the SWF on the server and output just one <object>. That avoids preloading several files (agree with ) and still uses ’s randomization idea.
<?php
header('Cache-Control: no-store'); // ensure a fresh pick each load
$swfs = ['promo1.swf','promo2.swf','promo3.swf'];
$pick = $swfs[array_rand($swfs)];
?>
<object type="application/x-shockwave-flash"
data="/swf/<?php echo rawurlencode($pick); ?>"
width="600" height="400"></object> Notes:
document.write; it is strongly discouraged and can break parsing. Create the element and appendChild it instead. See MDN’s guidance on document.write() for why this is risky. MDN: document.write()One more important update for anyone finding this later: Adobe officially retired Flash on December 31, 2020, and blocked Flash content from running in the player on January 12, 2021, so SWFs will not run in modern browsers. Adobe Flash Player EOL information If you are maintaining an old site, consider migrating the rotation to MP4/WebM or CSS/JS animations. The exact same server-side randomization pattern works with HTML5 <video> sources. MDN: the video element
Jump to Post— tgreer 189This is best done via server-side code. Any client-side code would probably involve pre-loading lots of Flash movies: a bad idea.
This is best done via server-side code. Any client-side code would probably involve pre-loading lots of Flash movies: a bad idea.
You might consider a random number generation and the use of document.writeln to write an edited set of HTML into the page to select a Flash file based off the random number. This wouldn't need the preloading of all the Flash objects as suggested before.
The various "document.write()" methods are deprecated, and will not work in all doctypes.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.