fsplayer.api.IPlayerListener Interface

The IPlayerListener interface is used to receive the notification that the player has been initialized. Until the player gets initialized it is not possible to control presentation playback or get presentation information.

The IPlayerListener interface declares the following method.

Table 1. Methods
Method Description
onPlayerInit(player:IPlayer):Void This method is invoked when the player initialization is complete.

Usually a class implementing the IPlayerListener interface is created.

import fsplayer.api.IPlayerListener;
import fsplayer.api.IPlayer;

class MyPlayerListener implements IPlayerListener
    // ...

    function onPlayerInit(player:IPlayer):Void
        // write your player initialization handler here

    // ...

Then the instance of MyPlayerListener object is passed to addListener() method of the IPlayer interface or to the setPlayerListener() method of the CPresentationLoader class which simplifies this process.

import fsplayer.api.IPlayer;
import MyPlayerListener;
import fsplayer.api.CPresentationLoader;

// create instances of the presentation loader and the player listener objects
var loader:CPresentationLoader = new CPresentationLoader();
var listener:MyPlayerListener = new MyPlayerListener();

// pass the listener object to the loader

// create a MovieClip instance where the presentation will be loaded
var presentationMC:MovieClip = this.createEmptyMovieClip("presentation", 1);

// load the presentation
loader.loadClip("presentation.swf", presentationMC);