?
Solved

Chage swfobject params usign javascript(jquery)

Posted on 2011-03-13
7
Medium Priority
?
557 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses

771 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