how to load flash movies into a movieclip using html and javascript

I am trying to find a way to load either movieclips or .swf files into a Flash movie from my html page. I have been researching using javascript, but have not had any success. I have 4 HTML text links which when clicked will each play a different movie and stop the other movies. I basically need a javascript function to loadmovie into my flash movie, which has a empty mc (loader_mc). I have been using this javascript code , but it only plays the movies ontop of each other. I need the movie to stop and load a new movie when clicked.

Thanks for your time.

<script type="text/javascript">
	function loadMovie(url,layer) {
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="Scripts/flexcroll.js" type="text/javascript"></script>
<body leftmargin="0" topmargin="0">
	<div id="prod_container">
		<div id="home">
		  <div align="right"><a href="#products" target="_self"></a><img src="images/products.jpg" width="250" height="30" /></div>
		<div id="product_list">
		  <table width="200" border="0" cellspacing="0" cellpadding="2">
              <td class="text"><div align="right"><a onclick='javascript:example.TPlay("_level0/movie1_mc")'href="#juice", target="_self">Juice</a>
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie2_mc")'href="#spreads", target="_self">Spreads</a> </div></td>			
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie3_mc")'href="#sauces", target="_self">Sauces</a>
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie4_mc")'href="#cherry", target="_self">Pitted Cherry</a></div></td>
              <td class="text"><div align="right"><a href="javascript:loadMovie("mc_products2.swf", "_root.test.content")">Export Order Form</a></div></td>
	  <div id="flashbox"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="example" name="example" codebase=",0,29,0" width="259" height="350">
<param name="movie" value="test.swf">
<param id="example" value="example">
<param name="example" value="example">
<param name="quality" value="high">
<embed src="test.swf" id="example" name="example" swliveconnect="true" quality="high" pluginspage="" type="application/x-shockwave-flash" width="259" height="350"></embed>

Open in new window

Who is Participating?
legionl2kAuthor Commented:
Wello I managed to work it out in the end. It seems there were errors in the Javascript code supplied from the tutorial. I just took the T out of the TPlay.

" (<td class="text"><div align="right"><a onClick='javascript:example.TLoad("_level0/movie2_mc")'href="#spreads", target="_self">Spreads</a>
Now it loads no problem.

Hi legionl2k,

Maybe I'm missing the point here, but if you want to load swf's into your currently loaded swf. Then I suggest doing this through actionscript.

Write the code for loading the movies inside your main flash application.


legionl2kAuthor Commented:
Sorry I should have spelled it out a bit more thoroughly. The 4 text links in the HTML page are working with a custombuilt scrollpane. The user clicks on a link and the scrollpane moves to the desired named anchor, then the main movie is triggered to play that particular product movie. So I have the scroll pane named anchor working fine with a <A HREF>, and I have included a <A OnClick> to handle the loadmovie call.

(<td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie2_mc")'href="#spreads", target="_self">Spreads</a>

So I need a way of doing both things (named anchor & loadmovie call ) with the one text link.

I hope this clears it up. Im at my wits end. I have tried so many tutorials I am getting really lost. Its such a simple thing too, according to the forums !!
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.