spacer
Yehuda Shiran June 3, 2001
Replacing a Movie on the Fly
Tips: June 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
SaaS Tool Offers Custom Database Development
Microsoft’s Automated Agent: Can We Talk?
Borland Finally Sells CodeGear
In some of your applications you may need to use Flash movies and JavaScript directly, without any prepackaged APIs such as the FlashSound JavaScript API. You will enjoy more features, methods, and properties, but you'll have to take care of all the tiny details that are taken for granted when using the FlashSound API, for example.

One of those "tiny" details is embedding the Flash object. The JavaScript file flashmoviecheck.js does exactly this, as well as other stuff. For example, it checks whether a Flash player exists (Flash plug-in or ActiveX control), and whether its version is higher than the minimum required by the application.

Use the Flash method LoadMovie() to load a SWF file. The syntax is:

  LoadMovie(layerNumber, URL)
This method loads a given SWF (2nd argument) into the SWF object that the method belongs to. The parameter layerNumber designates the position of the new SWF with respect to other SWFs in the same page area. Set layerNumber to zero to ensure that any old SWFs are deleted before the new SWF is loaded.

In this tip we preload swift3d.swf. You can see its traces in the window below. When you click the Load Movie link, another SWF, opener.swf (courtesy of www.associatesinscience.com), will be loaded instead of the previous SWF. Use the following links to play, rewind, and load opener.swf:

Rewind | Play | Load Movie

Here is the code:


<SCRIPT LANGUAGE="JavaScript" SRC="flashmoviecheck.js"></SCRIPT>
<A href="javascript://" 
   onclick="javascript:mySwf.Rewind(); 
   return false">Rewind</A> | 
<A href="javascript://" 
   onclick="javascript:mySwf.Play(); 
   return false">Play</A> | 
<A href="javascript://" 
   onclick="javascript:mySwf.LoadMovie(0, 'opener.swf'); 
   return false">Load Movie</A>
<SCRIPT LANGUAGE="JavaScript">
  Flash_embedSWF("swift3d.swf");
  var mySwf = window.document.sonify;
</SCRIPT>


People who read this tip also read these tips:

Look for similar tips by subject:



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
How to Create an Ajax Autocomplete Text Field: Part 6 · Software Engineering for Ajax · Perl Pragma Primer
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Using File Virtualization for Disaster Recovery · VoIP Security: SIP—Versatile but Vulnerable · Around the World in 80 Nodes