Solved

changing source of embedded flash video using javascript

Posted on 2008-10-02
5
2,286 Views
Last Modified: 2012-05-05
Greetings EE Gods.

Using ASP.net, I can employ this line:
<img id="product_fullimage" alt="" runat="server" />

From other images, I can change the source of the img tag on the fly using javscript:
onclick=\"",fullimage,".src='/Content/images/products/", previewimage.fullimage, "';\""

Can I do this with embedded SWF and FLVs?
<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="400" HEIGHT="300"
CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0">
<PARAM NAME="MOVIE" VALUE="sample.swf">
<PARAM NAME="PLAY" VALUE="true">
<PARAM NAME="QUALITY" VALUE="best">
<PARAM NAME="LOOP" VALUE="true">
<EMBED SRC="sample.swf" WIDTH="400" HEIGHT="300" PLAY="true" LOOP="true" QUALITY="best"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>

Thanks.
0
Comment
Question by:Evan Cutler
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 22631418
Hello arcee123,

AFAIK changing Object param attribute dynamically using javascript is not allowed. You have to first delete the object and create a new object with new param

HTH
I
0
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 500 total points
ID: 22631425
Here's a sample


function setFlashSrc(newSrc)

{

      var 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="210" HEIGHT="210">';

      flash+='<PARAM NAME=movie VALUE="'+newSrc+'"><PARAM NAME=quality VALUE=high>';

      flash+='<EMBED SRC="'+newSrc+'" QUALITY=high PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" ';

      flash+='TYPE="application/x-shockwave-flash" WIDTH="210" HEIGHT="210">';

      flash+='</EMBED>';

      flash+='</OBJECT>';

      document.getElementById("urgeo").innerHTML=flash;

}

Open in new window

0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 22631671
can I embed that function in the middle of the body?

Thanks
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 22631935
where ever you want.
RegisterClientScripBlock will do it or attach to onclik or onload or other suitable event.

HTH

I
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 31502662
Thank you.
I'll get this to work.

Evan
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now