spacer
Yehuda Shiran June 1, 2001
Selecting a Scene
Tips: June 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
In some of your applications you may need to use Flash movies and JavaScript directly, without any prepackaged APIs such as 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 FlashSound API, for example.

One of the "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 GotoFrame() to go to a certain frame. The syntax is:

  GotoFrame(frameNumber)
Flash activates the frame number specified by frameNumber in the current movie. If the frame is not yet loaded, the player goes to the last frame currently available and stops, causing unexpected behavior during playback. Use the PercentLoaded() method to check the loading status of your movie, and determine whether your specific frame is already current.

The argument frameNumber is zero-based. The first frame is 0, the second frame is 1, etc. This is not in synch with the frame numbering scheme within Flash, where the frames start at 1 (the Goto action, for example). Play around with the following three links. You can rewind the movie, play it from its current position, and go to frame 300.

Rewind | Play | Go To Frame 300

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.GotoFrame(300); return false">Go To Frame 300</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:

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

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags