SoundLoad

Kind of class:class
Inherits from:BytesLoad < RetryableLoad < Load < EventDispatcher < CoreObject
Version:01/26/07
Author:Aaron Clinger
Classpath:org.casalib.load.media.sound.SoundLoad
File last modified:Monday, 01 December 2008, 13:34:40
Eases the chore of loading mp3s.
Since:
  • Flash Player 7
Usage note:
  • This class only works with event sounds and does not support streaming sounds. Event onInstantiate is called once the first loaded byte(s) have been received.
Example:
  • function onSoundComplete(sender:SoundLoad):Void {
        sender.getSound().start();
    }
    
    function onSoundLoading(sender:SoundLoad, bytesLoaded:Number, bytesTotal:Number):Void {
        trace(bytesLoaded + "/" + bytesTotal + " bytes have been loaded into " + sender.getMovieClip());
    }
    
    this.createEmptyMovieClip("soundContainer_mc", this.getNextHighestDepth());
    
    var audioClip:SoundLoad = new SoundLoad(this.soundContainer_mc, "audio.mp3");
    this.audioClip.addEventObserver(this, SoundLoad.EVENT_LOAD_COMPLETE, "onSoundComplete");
    this.audioClip.addEventObserver(this, SoundLoad.EVENT_LOAD_PROGRESS, "onSoundLoading");
    this.audioClip.start();

Summary


Constructor

SoundLoad

function SoundLoad (
target_mc:MovieClip, mp3Path:String)

Defines file and location of load triggered by start.
Parameters:
target_mc:
The MovieClip instance on which the Sound object operates.
mp3Path :
The absolute or relative URL of the MP3 file to be loaded.

Instance methods

destroy

function destroy (
) : Void

getBytesLoaded

function getBytesLoaded (
) : Number

getBytesTotal

function getBytesTotal (
) : Number

getMovieClip

function getMovieClip (
) : MovieClip

Returns:
  • Returns MovieClip specified as target_mc in SoundLoad.

getSound

function getSound (
) : Sound

Returns:
  • Returns the sound object SoundLoad class is wrapping and loading.