Embedding Movies with Flash, Part I: Basic Methods: Replacing and Superimposing a Movie - Doc JavaScript | WebReference

Embedding Movies with Flash, Part I: Basic Methods: Replacing and Superimposing a Movie - Doc JavaScript


Embedding Movies with Flash, Part I: Basic Methods

Replacing and Superimposing a Movie

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 0 to ensure that any old SWFs are deleted before the new SWF is loaded. Set layerNumber to 1 to superimpose the new SWF on top of the previous SWF.

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

Rewind | Play | Replace Movie | Superimpose 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">
  Replace Movie</A> |
<A href="javascript://" onclick="javascript:mySwf.
  LoadMovie(1, 'opener.swf'); return false">
  Superimpose Movie</A>
<SCRIPT LANGUAGE="JavaScript">
  Flash_embedSWF("swift3d.swf");
  var mySwf = window.document.sonify;
</SCRIPT>

Next: How to zoom a movie

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: June 4, 2001
Revised: June 4, 2001

URL: http://www.webreference.com/js/column85/6.html