Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

changing source of embedded flash video using javascript

Posted on 2008-10-02
5
2,289 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

828 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