slideplayer.api.ISoundController Interface

The ISoundController Interface provides the following methods for sound control.

Table 1. Methods
Method Description
getVolume():Number Returns current sound volume. Note: sound volume is a number between 0 and 1
setVolume(volume:Number):Void Sets sound volume. Note: sound volume is a number between 0 and 1

Samples

var g_slideController:ISlideController;var g_soundController:ISoundController;

function loadSlide(slideIndex:Number):Void
{
        var ml:MovieClipLoader = new MovieClipLoader();
        ml.addListener(this);
        var fileName:String = "data_snd/slide" + slideIndex + ".swf";

        var slashPos:Number = Math.max(this._url.lastIndexOf("/"), this._url.lastIndexOf("\\"));
        var fullPath:String = this._url.substr(0, slashPos + 1) + fileName;
        ml.loadClip(fullPath, slideMC1);
        loadingLabel.text = this._url;
}

function onLoadInit(target:MovieClip):Void
{
    g_slideController = target.getSlideController();
    g_soundController = g_slideController.getSoundController();
    g_trackBar.setPos(g_soundController.getVolume());
}

g_trackBar.newPos = function(pos:Number):Void
{
    g_soundController.setVolume(pos);
}
       

Demo

The following demo illustrates ISoundController interface usage to control sound volume on the slide.