[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Chage swfobject params usign javascript(jquery)

Posted on 2011-03-13
7
Medium Priority
?
558 Views
Last Modified: 2012-06-27
hi experts,

i have a page that contains a flash video player

<div id="video-player">
	<script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("media/VideoPlayer_small.swf", "Videoplayer", "299", "168", "10", "#ffffff");
			so.addVariable("MMredirectURL",window.location);
			so.useExpressInstall('js/detection/expressinstall.swf');
			so.setAttribute("redirectUrl","js/detection/noflash.html");
			so.addParam("menu","false");
			so.addParam("scale","noscale");
			so.addParam("quality","high");
			so.addParam("allowFullScreen","true");
			so.addParam("wmode","transparent");
			so.addParam("FlashVars", "videoURL=media/test.flv");
			so.write("video-player");
		// ]]>
	</script>
</div>

Open in new window



an i would like to change
so.addParam("FlashVars", "videoURL=media/test.flv");

Open in new window

to
so.addParam("FlashVars", "videoURL=media/test2.flv");"

Open in new window

dynamically by clicking a link like <a href="#" onlick="javascript:ChangeVideo('media/test2.flv');">change video</a>

any ideas?

0
Comment
Question by:spacehsheep
[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
  • 3
7 Comments
 
LVL 5

Expert Comment

by:edchipman
ID: 35122869
You will need to re-load the swf for this to work, unfortunately you cannot change the flashvars and have flash notice that. However you could make a method available to javascript to change the video using ExternalInterface. Have a look at http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html#addCallback%28%29
0
 

Author Comment

by:spacehsheep
ID: 35160053
Thanks edchipman for your reply, actually i'm able to change flash vars by removing swfobject from dom and adding a new one to the dom with the help of wonderful plugin http://jquery.thewikies.com/swfobject/ 
0
 
LVL 5

Expert Comment

by:edchipman
ID: 35161587
I believe I mentioned this at the beginning of my post "You will need to re-load the swf for this to work"
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:spacehsheep
ID: 35164117
ok i can give points to you but you said "unfortunately you cannot change the flashvars and have flash notice that" and your solution was to change it using ExternalInterface, which totally has no similarity with my solution and didn't help me to solve my problem.

if you think you deserved points i will accept
0
 
LVL 5

Accepted Solution

by:
edchipman earned 375 total points
ID: 35179476
You know what leave it I should have worded it differently to make it clearer. Essentially what you are doing here is reloading the swf. When you remove the swfobject as you say you are doing you unload it. Then when you re-add it the browser re-loads this swf.
0
 

Author Closing Comment

by:spacehsheep
ID: 35180473
Partially solved my question
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
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 goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

650 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