Solved

Chage swfobject params usign javascript(jquery)

Posted on 2011-03-13
7
556 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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 125 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

Independent Software Vendors: 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

I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
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 goal of the tutorial is to teach the user how to how to record live broadcast.
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.

724 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