Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2009-02-14
Medium Priority
Last Modified: 2013-11-17
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="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>

Open in new window

Question by:legionl2k
  • 2

Expert Comment

ID: 23641126
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.



Author Comment

ID: 23641183
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 !!

Accepted Solution

legionl2k earned 0 total points
ID: 23643965
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.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

564 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