0

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

Levi Botelho
  • 24,626
  • 5
  • 61
  • 96
Prasanth A R
  • 4,046
  • 9
  • 48
  • 76

1 Answers1

2

remove:

alert(path);

Change the:

alert(flash);

to:

document.write(flash);
aledujke
  • 1,125
  • 7
  • 15
  • thanx for answer... how it is dynamically change flash one by one – Prasanth A R Jun 13 '13 at 11:24
  • 1
    You want to have multiple flash objects on a page or just one that changes on button click? – aledujke Jun 13 '13 at 11:25
  • i have multiple flash files and changes on one by one on a button click ... and the name of flash files are a0.sef,a1.swf..etc – Prasanth A R Jun 13 '13 at 11:27
  • 1
    I understood that, but what do you want to achieve... to show them all on button click (one after another) OR to show one by one after each button click OR to show one, then remove that one after clicking the button again and showing another? – aledujke Jun 13 '13 at 11:29
  • 1
    What does it do now? try this: var flash =''; replace first "flash +=" with "var flash =" – aledujke Jun 13 '13 at 11:37
  • i just use this code – Prasanth A R Jun 13 '13 at 12:08