Solved

changing source of embedded flash video using javascript

Posted on 2008-10-02
5
2,290 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
[X]
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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Html date format 9 20
Duplicate Elements with JS / jQuery 3 24
orderby list (from Json) 1 29
powershell try catch  and $ErrorActionPreference = continue 6 24
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…

756 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