Link to home
Start Free TrialLog in
Avatar of legionl2k
legionl2k

asked on

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

HI,
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.

Scott
<script type="text/javascript">
 
	function loadMovie(url,layer) {
 
		test.loadMovie(url,layer);
}
 
 
 
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script src="Scripts/flexcroll.js" type="text/javascript"></script>
 
 
</head>
 
<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>
		<div id="product_list">
		  <table width="200" border="0" cellspacing="0" cellpadding="2">
           <tr>			
              <td class="text"><div align="right"><a onclick='javascript:example.TPlay("_level0/movie1_mc")'href="#juice", target="_self">Juice</a>
              </div></td>
            </tr>
            <tr>
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie2_mc")'href="#spreads", target="_self">Spreads</a> </div></td>			
            </tr>
            <tr>
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie3_mc")'href="#sauces", target="_self">Sauces</a>
              </div></td>
            </tr>
            <tr>
              <td class="text"><div align="right"><a onClick='javascript:example.TPlay("_level0/movie4_mc")'href="#cherry", target="_self">Pitted Cherry</a></div></td>
            </tr>
            <tr>
              <td class="text"><div align="right"><a href="javascript:loadMovie("mc_products2.swf", "_root.test.content")">Export Order Form</a></div></td>
            </tr>
          </table>
		</div>
	  <div id="flashbox"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="example" name="example" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,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="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="259" height="350"></embed>
</object></div>

Open in new window

Avatar of Dreammonkey
Dreammonkey
Flag of Belgium image

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.

regards,

DM
Avatar of legionl2k
legionl2k

ASKER

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 !!
Doh!
ASKER CERTIFIED SOLUTION
Avatar of legionl2k
legionl2k

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