swf swap

Hi,
I am looking for a way to change Flash files when a user clicks on a link.
This is for a portfolio site. All of the SWF movies are the same size and go in the same position.
I would like to do this without reloading the page.
Can you offer a JavaScript (or other) solution?
Thanks,
Josh
Josh FialkoffFounder/CEO Asked:
Who is Participating?
 
Josh FialkoffConnect With a Mentor Founder/CEO Author Commented:
Hi,

I found a solution to my problem.

This link did the trick: http://www.javascriptpost.com/javascript/how-dynamically-change-flash-movie-t11936.html.

Here's the code:
<HTML>
<HEAD>
<script>
function changeFlash(url){
var d=document;
(d.all)? d.all("flashMov1").movie = url :
d.embeds["flashMov2"].src = url;
}
 
</script>
</HEAD>
<BODY>
<object id=flashMov1
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
width="200" height="150">
<param name="movie" value="f1.swf">
<param name="quality" value="high">
 
<EMBED name=flashMov2 src="f1.swf" quality=high
WIDTH="200" HEIGHT="150"
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</object>
<p> </p>
<p><a href="javascript: changeFlash('f1.swf')">One </a></p>
<p><a href="javascript: changeFlash('f2.swf')">Two</a></p>
<p><a href="javascript: changeFlash('f3.swf')">Three</a></p>
 
</BODY>
</HTML>

Open in new window

0
 
quincydudeCommented:
Is your swf embedded in a object tag?
If yes you can set the object with an id and get the object at runtime by

var myobject = document.getElementByid('myFlashObj')


and you can set the HTML of the object using

myobject.innerHTML
0
 
Josh FialkoffFounder/CEO Author Commented:
Thanks Dude!

This is the code for the Flash, so I believe so.

Here is a URL for the page: http://019d900.netsolhost.com/Wordpress/

-Josh

<div style="text-align: center; width:360px; height:250px; line-height:250px; margin-left: auto; background: #58585a;"><div id="swf4e5f1">This movie requires Flash Player 9</div></div>
 
<script type="text/javascript">
	swfobject.embedSWF("/Wordpress/wp-content/uploads/SampleSlides/home_slides.swf", "swf4e5f1", "360", "250", "9.0.0", "", {}, {wmode: "window", menu: "false", quality: "high", bgcolor: "#58585a"}, {});
</script>
			<li id="text-333168321" class="widget widget_text">						<div class="textwidget"><?php wp_swfobject_echo("/wp-content/uploads/SampleSlides/home_slides.swf", "360", "250"); ?></div>
		</li>
</div>

Open in new window

0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Josh FialkoffFounder/CEO Author Commented:
0
 
Josh FialkoffFounder/CEO Author Commented:
I have tried that method here: http://019d900.netsolhost.com/Wordpress/wp-content/galleries/test.html.

Thanks,
Josh
0
 
Josh FialkoffFounder/CEO Author Commented:
This works well, but it does load a movie when the page loads.

How can I accomplish this?

Thanks!

-Josh
0
 
quincydudeCommented:
That piece of code looks fine.
Can you clarify your issue as I cannot understand what problem are you talking about.
0
 
Josh FialkoffFounder/CEO Author Commented:
The page was not loading a flash movie on load, but that is now working. The issue is resolved. Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.