slideplayer.api.IPlaybackController Interface

The IPlaybackController interface provides methods for slide playback control. This interface can be obtained by calling getPlaybackController() method on ISlideController interface.

The IPlaybackController interface exposes the following methods:

Table 1. Methods
Method Description
addListener(listener:IPlaybackListener):Void Adds an external object implementing IPlaybackListener interface; it will be notified about events during playback; the passed object will receive slide playback event notifications
removeListener(listener:IPlaybackListener):Void Removes previously added listener object. The passed object won't receive notifications from the playback controller any more
isPlaying():Boolean Returns a Boolean value indicating whether the slide is playing or not
play():Void Resumes slide playback
pause():Void Suspends slide playback
getPosition():Number Returns slide playback position Note: playback position is a number between 0 and 1
playFromPosition(position:Number):Void Plays the slide from specified position. Note: playback position is a number between 0 and 1
pauseAtPosition(position:Number):Void Suspends slide at the specified position. Note: playback position is a number between 0 and 1
getCurrentStepIndex():Number Returns current animation step index
gotoNextStep():Void Plays the slide from the beginning of the next animation step
gotoPreviousStep():Void Moves slide playback one step back. This method suspends slide playback at the end of the previous animation step
playFromStep(stepIndex:Number):Void Plays the slide from the beginning of the specified animation step
pauseAtStepStart(stepIndex:Number):Void Suspends the slide at the beginning of the specified animation step
pauseAtStepEnd(stepIndex:Number):Void Suspends the slide at the end of specified animations step

Samples

The following example illustrates how to obtain and use the IPlaybackController interface to control slide playback

import slideplayer.api.*;

// slide loading and initialization code is placed here
// ...

var g_slideController:ISlideController;
var g_playbackController:IPlaybackController;

// this function is called when slide movie clip has been loaded
function onLoadInit(target:MovieClip):Void
{
    g_slideController = target.getSlideController();
    g_playbackController = g_slideController.getPlaybackController();
}

playPauseSlideButton.onRelease = function()
{
    if (g_playbackController)
    {
        if (g_playbackController.isPlaying())
        {
            g_playbackController.pause();
        }
        else
        {
            g_playbackController.play();
        }
    }
}

Demo

This demo illustrates slide playback control via IPlaybackController interface.