Embedding Sound with Flash, Part IV: Native JavaScript: Using Flash Methods - Doc JavaScript | WebReference

Embedding Sound with Flash, Part IV: Native JavaScript: Using Flash Methods - Doc JavaScript


Embedding Sound with Flash, Part IV: Native JavaScript

Using Flash Methods

Let's demonstrate a few methods of the Flash JavaScript object. The following function checks for the minimum player version and then jumps to the required frame to start the sound. The sonified_flash() function accepts one parameter (the frame number), checks for the minimum player version number, creates a SWF object, ensures that the SWF is 100% loaded, and then jumps to the given frame:

function sonified_flash(myFrame) {
  if(!Flash_checkForMinPlayer()) {return;}
  mySwf = window.document.sonify;
  if (mySwf.PercentLoaded()

We showed here two methods: PercentLoaded() and GotoFrame(). The following links demonstrate the embedding of animalsounds.swf in this page. Try these links and refresh your last visit to the farm:

| Dog Barking | Frog Ribbet | Horse Whinny | Cat meow |

You need to include the file flashsoundcheck.js in the HEAD section of your page:

<SCRIPT LANGUAGE="JavaScript" SRC="flashsoundcheck.js">
</SCRIPT>

This file includes the function Flash_embedSWF() which embeds SWFs, and does all the necessary checking of the browser/plug-in combinations. The animal sound links above are implemented by the following code:

| <A href="javascript://" onclick="sonified_flash(10);
  return false">Dog Barking</a> |
<A href="javascript://" onclick="sonified_flash(30);
  return false">Frog Ribbet</a> |
<A href="javascript://" onclick="sonified_flash(60);
  return false">Horse Whinny</a> |
<A href="javascript://" onclick="sonified_flash(80);
  return false">Cat meow</a> |
<SCRIPT LANGUAGE="JavaScript">
  Flash_embedSWF("animalsounds.swf");
</SCRIPT>

Next: How to use an invisible frame

https://www.internet.com


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

URL: https://www.webreference.com/js/column84/5.html