![]() |
|
|
|
dynapi.fx.FlashSound - Quick Reference |
Inherit: DynLayer |
|
What is the FlashSound Javascript API?
A custom javascript class for streamlining issues related to using
javascript to control "sound only" swf loaded in an embedded flash
player. This javascript class enables a web developer to focus on creating
content rather than dealing with browser/player compatibility issues and the
idiosyncrasies of using javascript to control plug-ins for Netscape and activeX
controls for windows Internet Explorer.
Note: FlashSound for DynAPI is a modified version of the original FlashSound API library found at www.flashsoundapi.com. Please make note of the necessary changes made to the modified version. Some methods and properties of the original library was removed from this version.
FlashSound(swfURL, loop, autostart) -
swfURL - url of swf to be embedded (optional)
[none]
autostart - (Boolean) Value must be set before calling the setSWF( ) method to override default play attribute value of true. The autostart property is equivalent to the play embed attribute. If set to true, the player automatically begins playing when the swf is loaded in the player. If set to false, the player waits for
play( ) or gotoAndPlay( ) to begin playback.
Note: If there is any content in frame 1 of the root timeline, Flash player versions 4-5 will automatically play a movie even if autostart = false. The player essentially ignores autostart = false in this situation. To work around this problem, add content on or after frame 2 of the root timeline
example:
fsnd.autostart=true; fsnd.setSWF('themes.swf');
loop - (Boolean) Value must be set before calling the setSWF( ) method to override default loop attribute value of false. If set to true, the player loops playback when reaching the final frame of swf. If set to false the player will stop after playing the final frame. A stop actionscript statement on the main timeline prevents a movie from looping even if the loop attribute is true
playerID - (String) Returns the name/id attribute for the player.
setSWF(swfURL) - Sets the "sound only" swf for the minimum supported player and supported browsers. Originally called embedSWF()
isPlaying() - Returns true if the playhead is moving and false if the playhead is stopped. IsPlaying( ) checks for a moving playhead, not for play state of sounds set to event or start sync. Originally called IsPlaying()
isPlayerReady() - Returns true if the browser recognizes the player associated with the instance as a javascript object, and the swf has loaded at least one frame. Otherwise returns false. This method also returns false if the FlashSound.engage static property is set to false.
loadMovie(layerNumber,url) - Loads the movie identified by url into the layer specified by layerNumber. This method does not support loading swf into targeted movie clips or setting variables like the loadMovie actionscript statement. Originally called LoadMoview()
layerNumber - (Integer) number representing layer to receive external swf url - (String) URL of swf to be loaded into the player.
example:
mysound.LoadMovie(1, "some.swf");
percentLoaded() - (Integer) Returns the percent of the swf loaded into browser. Values are 0 - 100 represented as Integer. Not affected by the FlashSound.engage static property. Originally called PercentLoaded()
example:
if (mysound.PercentLoaded == 100) {mysound.TGotoAndPlay("/sound", "start")}
gotoAndPlay(target,frame) - Moves playhead to frame number or label of target timeline and starts playback at that point. Target timeline names use the "slash" syntax common to pre-ECMA actionscript. Use "/" to specify the main timeline (parent). Frame numbering starts with 1 for this method, unlike original flash javascript API which starts frame numbering at 0. Originally called TGotoAndPlay().
target - (String) path and timeline name of target timeline using "slash" syntax. location - frame number(Integer) or label(String) where playback is to start
example:
mysound.TGotoAndPlay("/sometimeline",5)
gotoAndStop(target,frame) - Moves playhead to frame number or label of target timeline, executes contents of this frame and stops. Target timeline names use the "slash" syntax common to pre-ECMA actionscript. Use "/" to specify the main timeline (parent). Frame numbering starts with 1 for this method, unlike original flash javascript API which starts frame numbering at 0. Originally called TGotoAndStop().
target - (String) path and timeline name of target timeline using "slash" syntax. location - frame number(Integer) or label(String) where playback is to start
isLoaded(target) - Checks to see if all frames of a given target timeline are loaded and returns true or false. Compares frames loaded to total number of frames of a given target timeline. You're advised to check if isLoaded( ) is true before trying to use gotoAndPlay( ) to start playback at a given frame or label. Use isLoaded( ) with "/" to check for load of swf. Originally called TLoaded().
target - (String) path and timeline name of target timeline using "slash" syntax.
example:
if(mysound.isLoaded("/sometimeline")) {mysound.gotoAndPlay("/sometimeline", 5)}
play(target) - Starts the playhead moving on the target timeline at the frame where playhead last stopped or first frame. Target timeline names use the "slash" syntax common to pre-ECMA actionscript. Use "/" to specify the main timeline (parent). It begins playback at frame 1 of given timeline or at the frame where playback was last stopped with the stopPlay( ) method. Calling play( ) defaults to the root timeline if no target path is specified. Originally called TPlay().
target - (String) path and timeline name of target timeline using "slash" syntax.
TStopPlay(target) - Stops playhead on the timeline specified. Target timeline names use the "slash" syntax common to pre-ECMA actionscript. Use "/" to specify the main timeline (parent). The stopPlay() function is equivalent to the stop actionscript statement and will only stop playback of sounds set to stream sync. stopPlay() does not stop playback of sounds set to event or start sync. stopPlay( ) defaults to the root timeline if no target path is specified. Originally called TStopPlay().
target - (String) path and timeline name of target timeline using "slash" syntax.
_recognizeMethod(objstr)
_checkForInstance()
FlashSound.engage - The engage property controls the execution of certain instance methods. If the engage property is false, then the affected methods will not execute. This property affects all instance methods except for instance.setSWF( ) and instance.percentLoaded().
FlashSound.playerVersion - Returns player version number of plug-in or activeX control. Returns zero if user does not have the player. Read only. Assigning a value to playerVersion can cause errors.
FlashSound.setMinPlayer(vers) - 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 script will not embed swf content. The FlashSound script 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 an instance is created.
vers - player version number