Solved

Chage swfobject params usign javascript(jquery)

Posted on 2011-03-13
7
551 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
  • 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 what frame rate is, how to control it and what effect it has on the video.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now