Prasanth A R
Prasanth A R

Reputation: 4174

Display flash using JavaScript function

I want to change the Flash using the on click command with JavaScript

now, here the button works correctly but the flash does not display...

JavaScript code

<script>
var count=0;

function mafunct(flash){
var path="a"+count+".swf";  

    flash+='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" WIDTH="100%" HEIGHT="100%">';          
    alert(path);
    flash+='<PARAM NAME="movie" VALUE='+path+' >';          
    flash+='<PARAM NAME="PLAY" VALUE="false">';  
    flash+='<PARAM NAME="LOOP" VALUE="false">';
    flash+='<PARAM NAME="QUALITY" VALUE="high">';
    flash+='<PARAM NAME="SCALE" VALUE="SHOWALL">';
    flash+='<EMBED NAME="testmovie" SRC="Menu.swf" WIDTH="100%" HEIGHT="100%"PLAY="false" LOOP="false" QUALITY="high" SCALE="SHOWALL"swLiveConnect="true"PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">';
    flash+='</EMBED>';
    flash+='</OBJECT>';     
document.write(flash);
count++;

}
</script>

HTML button code

<button onclick="mafunct()">next</button>

My flash files are named a0.swf,a1.swf.... etc

Upvotes: 0

Views: 1353

Answers (1)

aledujke
aledujke

Reputation: 1135

remove:

alert(path);

Change the:

alert(flash);

to:

document.write(flash);

Upvotes: 2

Related Questions