# Random image script for .swf files

**URL:** <https://forum.kirupa.com/t/random-image-script-for-swf-files/224821>\
**Category:** Uncategorized\
**Created:** [May 5, 2007, 10:30pm UTC](https://forum.kirupa.com/t/random-image-script-for-swf-files/224821 "2007-05-05T22:30:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![widphoto](https://avatars.discourse-cdn.com/v4/letter/w/3d9bf3/32.png) [@widphoto](https://forum.kirupa.com/u/widphoto)\
**Post date:** [May 5, 2007, 10:30pm UTC](https://forum.kirupa.com/t/random-image-script-for-swf-files/224821/1 "2007-05-05T22:30:21Z")

</div>

Does anyone know of a easy script for playing .swf movie’s from a random script that does not require alot of code knowledge and advanced php software?

I have 4 .swf files exported from Adobe ImageReady (of all things) that I wish to randomly display on my site.

Hopefully someone can get back to me soon, not much time on this.

This is the code I am currently using for .gifs but wont work for .swf’s

[FONT=Arial][SIZE=1] // Advanced Random Images Start  
var j,d="",l="",m="",p="",q="",z="",KW\_ARI= new Array();  
KW\_ARI[KW\_ARI.length]=‘random/one.gif?&width=432&height=216’;  
KW\_ARI[KW\_ARI.length]=‘random/two.gif?&width=432&height=216’;  
KW\_ARI[KW\_ARI.length]=‘random/three.gif?&width=432&height=216’;  
KW\_ARI[KW\_ARI.length]=‘random/four.gif?&width=432&height=216’;  
j=parseInt(Math.random()_KW\_ARI.length);  
j=(isNaN(j))?0:j;  
if (KW\_ARI[j].indexOf(’?’)==-1) {  
document.write("\<img src=’"+KW\_ARI[j]+"’\>");  
}  
else {  
nvp=KW\_ARI[j].substring(KW\_ARI[j].indexOf(’?’)+2).split(’&’);  
for(var i=0;i\<nvp.length;i++) {  
sub=nvp_.split(’=’);  
switch(sub[0]) {  
case ‘link’:  
l="\<a href=’"+unescape(sub[1])+"’\>";  
p="\</a\>";  
break;  
case ‘target’:  
q=" target=’"+unescape(sub[1])+"’";  
break;  
default:  
m+=" “+sub[0]+”=’"+unescape(sub[1])+"’";  
break;  
}  
}  
z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+"\>":l):"";  
z+=’\<a href=“stock.html”\>\<img src="’+KW\_ARI[j].substring(0,KW\_ARI[j].indexOf(’?’))+’" border=“0” name=“billboard”’+m+"\>"+p+’\</a\>’;  
document.write(z);  
}  
// Advanced Random Images End[/SIZE][/FONT]

[http://www.widstock.com](http://www.widstock.com)  
russ
