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

5
  • is it video? or something else in flash Commented Jun 13, 2013 at 11:19
  • Why do you alert() the flash string instead of appending it to the document? Commented Jun 13, 2013 at 11:21
  • it's just a flash video file Commented Jun 13, 2013 at 11:21
  • ok just update the question Commented Jun 13, 2013 at 11:21
  • refer this SO question, here you will get your all answer Commented Jun 13, 2013 at 11:27

1 Answer 1

2

remove:

alert(path);

Change the:

alert(flash);

to:

document.write(flash);
Sign up to request clarification or add additional context in comments.

6 Comments

thanx for answer... how it is dynamically change flash one by one
You want to have multiple flash objects on a page or just one that changes on button click?
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
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?
What does it do now? try this: var flash ='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="download.macromedia.com/pub/shockwave/cabs/flash/…" WIDTH="100%" HEIGHT="100%">'; replace first "flash +=" with "var flash ="
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.