FlashSound API sonify sites with Flash
News           Documentation           Tutorials           Extensions           Download           Forum           Contact

• Overview
• New in this Version

API Index
» Static Methods
• Static Properties
• Instance Methods
• Instance Properties

• Tutorials
• Compatibility
• Version History
• License
• Logic Flow chart

DocumentationStatic Methods

Static Methods can be used after the script tag containing the flashsound.js.

FlashSound.customEmbedSWF(embedStr,true|false)
Arguments

embedStr - list of embed attributes (required)
String type.

The second argument, defaults to true, causes the method to return the embed string. Not required.

Description

Checks for minimum supported player and supported browsers and writes out object/embed tags for SWF. The embedStr argument is required for this method. This JavaScript statement must be placed within the body of the html document. Use this method to embed a SWF with any combination of embed attributes and object parameters. SWF embedded with this static method do not support Javascript interaction and are not included in the FlashSound.players[] static property array. The default embed settings for this method are listed below.

WIDTH = 1, HEIGHT = 2
PLAY = true, LOOP = true
QUALITY = low, WMODE = transparent
BGCOLOR = web page bgcolor attribute

Example

<head>
<script src="flashsound.js"></script>
</head>

<body>
web page content........
<script>
FlashSound.customEmbedSWF(
  'SRC="player.swf" WIDTH=100 HEIGHT=50 ' +
  'WMODE="Opaque" BGCOLOR="#000000" ' +
  'QUALITY="high"'

);
</script>
</body>

Notes

If you embed a graphical SWF be sure to include appropriate values for QUALITY, WMODE and BGCOLOR. The default values for these attributes are intended for hidden SWF and should be altered so graphical SWF display properly.

Use the second argument for debugging purposes or for printing HTML containing object/embed to a window using JavaScript.


FlashSound.configuredForInteraction( )
Returns true | false
Boolean type.
Description

Returns true if user's browser supports JavaScript/player interaction and has minimum player required configuration for interaction.

Configuration requires that Java is enabled on LiveConnect supporting browsers, ActiveX is enabled in Windows IE and browser has minimum player required for interaction.

Default minimum interactive player is 4 for LiveConnect and ActiveX and 6r40 for XPConnect. Note that setMinPlayer( ) overrides this default.

Example

<head>
<script src="flashsound.js"></script>
</head>

<body>
web page content........
<script>
if(FlashSound.configuredForInteraction()){

  alert("Your browser supports interactive sound!");
}

</script>
</body>


FlashSound.embedSWF(srcURL, true|false)
Arguments

srcURL - url of swf to be embedded (required)
String type.

The second argument, defaults to true, causes the method to return the embed string. Not required.

Description

Checks for minimum supported player and supported browsers and writes out object/embed tags for hidden "sound only" swf. The srcURL argument is required for this method. This JavaScript statement must be placed within the body of the html document and preferably just before the closing body tag. Use this method to embed a hidden sound only SWF. SWF embedded with this static method do not support JavaScript/player interaction and are not included in the FlashSound.players[] static property array. The default embed settings for this method are listed below.

WIDTH = 1, HEIGHT = 2
PLAY = true, LOOP = true
QUALITY = low, WMODE = transparent
BGCOLOR = web page bgcolor attribute

Example

<head>
<script src="flashsound.js"></script>
</head>

<body>
web page content........
<script>
FlashSound.embedSWF("somepath/some.swf");
</script>
</body>

Notes Use the second argument for debugging purposes or for printing HTML containing object/embed to a window using JavaScript.

FlashSound.engageInteraction(state)
Values true | false (defaults to true)
Boolean type.
Description

The engageInteraction( ) static method turns on or off certain methods of all FSAPI instances. It does not control embedding or player detection methods. Passing a false value to the engageInteraction( ) method will prevent the affected methods from executing.

Example

<script src="flashsound.js"></script>
<script>
// disable playback of all instances
FlashSound.engageInteraction(false);
</script>

Notes

This method only affects instance methods that use the isPlayerReady( ) method. It has no relevance to native Flash JavaScript methods. One use for the engageInteraction( ) method is to deactivate the methods that control interactive sound for all instances. Below is a list of affected instance methods. Note that methods of extensions may also be affected by the engageInteraction property.

IsPlaying( ), LoadMovie( ), loadMovieNum( ),
gotoAndPlay( ), gotoAndStop( ), play( ), stop( )


FlashSound.hasMinPlayer()
Returns true | false
Boolean type.
Description

Returns true if supported browser has default minimum player version 4 or version set by setMinPlayer( ).

Otherwise returns false.

Example

<script src="flashsound.js"></script>
<script>
if(!FlashSound.hasMinPlayer()){
  alert("Get the latest Flash player to hear " +
       "background sound");
}
</script>

Note Default minimum required player for all supported browsers is 4.

FlashSound.hasMinInteractivePlayer()
Returns true | false
Boolean type.
Description

Returns true if Netscape browser supporting JavaScript/player interaction has minimum player version required for JavaScript/player interaction.

Otherwise returns false.

Example

<script src="flashsound.js"></script>
<script>
if(!FlashSound.hasMinPlayer()){
  alert("Get the latest Flash player to hear " +
       "interactive sound");
}
</script>

Note LiveConnect and ActiveX require minimum player version 4. XPConnect requires minimum player version 6r40.

FlashSound.initiateAutoInstall(req_vers)
Values

req_version string - player version comma separated string.

For example: "6,0,45,0" (This was first player to correctly support mp3 playback control)

Returns true | false
Boolean type.
Description

Must use this method before calls to embed methods.

Causes Windows IE browser to automatically download and install latest version of Flash player if the specified version is greater than the installed version. Appends the player version string on the end of the CODEBASE paraemeter for the ActiveX control. Always returns false for Windows IE browser.

Returns true if browser supporting Netscape style plug-in does not have plug-in or does not meet the minimum required plug-in version passed as the value of this method. Use the return value with if/then statement to redirect user to plug-in download page.

Example

<script src="flashsound.js"></script>
<script>
// set minimum required player
var auto=FlashSound.initiateAutoInstall("6,0,45,0");

// embed player
test.embedSWF("urlto.swf");


// redirect Netscape style plug-in browser
// these browsers do not support auto install

if(auto){
window.location.href = test.getAttributeValue("PLUGINSPAGE");
}

</script>

Note This does not override the setMinPlayer( ) value.

FlashSound.setMinPlayer(vers)
Arguments vers - player version number. (Required)
Integer type.
Description

Sets the minimum player version that the FlashSound script checks for. If a user does not have the player or has a version less than specified, the FlashSound API will not embed SWF content. The FlashSound API defaults to checking for player version 4, if no value for FlashSound.setMinPlayer( ) is specified.

FlashSound.setMinPlayer( ) cannot override the minimum FlashSound compatibility with player version 4. This statement should occur before the using any of the embed methods.

Example

<script src="flashsound.js"></script>
<script>
FlashSound.setMinPlayer(5);
</script>

Notes Will not override minimum interactive player for XPConnect unless value is higher than 6.
Copyright © 2003 Hayden Porter, All rights reserved.