Link to home
Start Free TrialLog in
Avatar of spacehsheep
spacehsheep

asked on

Chage swfobject params usign javascript(jquery)

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?

Avatar of edchipman
edchipman
Flag of Canada image

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
Avatar of spacehsheep
spacehsheep

ASKER

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/ 
I believe I mentioned this at the beginning of my post "You will need to re-load the swf for this to work"
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
ASKER CERTIFIED SOLUTION
Avatar of edchipman
edchipman
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Partially solved my question