Visit SlideShowPro.net  Community Forums
SlideShowPro Support Wiki
  
SlideShowPro Player

Methods

Document player compatibility
SlideShowPro Director
SlideShowPro Player SWF
SlideShowPro Player for Flash

Methods are public functions that can be called in the player to perform certain tasks, including navigation, toggling playback, etc.

The examples offered here use ActionScript, for that is the most common way of using the SlideShowPro Player's API. We also offer usage examples with SlideShowPro Player SWF and SlideShowPro Director in their respective sections of the wiki.

Quick Index: Loading...

enterFullScreenDisplayState()

Method; Sets the SlideShowPro Player to full screen. Calling this method has the same effect as clicking the full screen toggle button that's built into the navigation, or pressing the "F" key when keyboardControl is set to "On" and the SWF has focus.

Note: The Flash Player can only enter full screen mode when the user clicks on a button inside a SWF. This method cannot be executed via the Javascript API.

Parameters: None.

Returns: Nothing.

Example:

The following examples demonstrate how a button in Flash can be used to make the SlideShowPro Player enter full screen mode.

ActionScript 2:

my_btn.onRelease = function() {
   my_ssp.enterFullScreenDisplayState();
}

ActionScript 3:

my_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.enterFullScreenDisplayState();
}

getAlbumData()

Method; Retrieves the data for the currently loaded album. The object that is returned is the same as the one broadcasted by onAlbumData (AS2) and albumData (AS3). This method simply provides a way to retrieve the data directly without using an event listener.

Parameters: None.

Returns: Object.

Example:

The following AS3 example traces all the properties and property values in the object returned by getAlbumData() when a button is clicked.

my_btn.addEventListener("click",afterClick);
function afterClick(e:MouseEvent) {
	var o:Object = my_ssp.getAlbumData();
	for (var p in o) {
		trace(p + " = " + o[p]);
	}
}

getGalleryData()

Method; Retrieves the data for the entire gallery. The object that is returned is the same as the one broadcasted by onGalleryData (AS2) and galleryData (AS3). This method simply provides a way to retrieve the data directly without using an event listener.

Parameters: None.

Returns: Object.

Example:

The following example traces all the properties and property values in the object returned by getGalleryData() when a button is clicked.

my_btn.addEventListener("click",afterClick);
function afterClick(e:MouseEvent) {
	var o:Object = my_ssp.getGalleryData();
	for (var p in o) {
		trace(p + " = " + o[p]);
	}
}

halt()

Method; instructs the ActionScript 3 version of the SlideShowPro Player to stop any internal timers, events, and close any open audio channels. Should be used for garbage collection before unloading a SWF containing the SlideShowPro Player from a parent SWF (using Loader.unload()), or when moving the timeline playhead to a frame where the component is no longer visible.

This method isn't necessary with the ActionScript 2 version and thus isn't supported.

Parameters: None.

Returns: Nothing.

Example:

This example calls the halt method:

my_ssp.halt();

loadAlbum(albumID:String,contentID:String)

Method; Loads in the SlideShowPro Player the album requested through first parameter plus the content number assigned through the second parameter. This method should only be used after the SlideShowPro Player has initialized. If you are trying to load a particular album before the SlideShowPro Player initializes (thus changing which one it starts with) use API-setStartAlbum? instead.

Parameters:

albumNumber / albumID — You may assign either a number to signify the album's numerical position in the gallery array (starting at 0), or you may assign a string signifying the album's ID (as assigned through the XML file).

contentNumber / contentID — The content inside the album you wish to load first. You may assign either a number to signify the content's numerical position inside the album array (starting at 0), or you may assign a string signifying the content's ID (as assigned through the XML file).

Returns: Nothing.

Example:

The following example tells the slideshow instance to load the first image in the first album:

my_ssp.loadAlbum(0,0);

The following example instructs the the SlideShowPro Player instance to load the "nature" album and start with the content assigned an ID of "tree-1":

my_ssp.loadAlbum("nature","tree-1");

Note: to assign an ID to an album in your XML file, add it as an attribute:

<album id="nature"...>

And to assign an ID to content:

<img id="tree-1" ...>

loadContent(contentID:String)

Method; Loads the image in the current album associated with either the numerical array value, or the content's ID. If assigning a number, minimum value is 0, while the maximum is the total number of images in the current album.

Parameters:

contentNumber / contentID — The content inside the currently loaded album you wish to load. You may assign either a number to signify the content's numerical position inside the album array (starting at 0), or you may assign a string signifying the content's ID (as assigned through the XML file).

Returns: Nothing.

Example:

The following example tells the instance of the SlideShowPro Player to load the first image in the current album:

my_ssp.loadContent(0);

The following tells the instance of the SlideShowPro Player to load the image with an ID of "tree-1" inside the current album:

my_ssp.loadContent("tree-1");
Note: This method should not be used in conjunction with the loadAlbum() method. It is meant to be used when switching content within the current album. To load a specific album and image, simply use loadAlbum().

muteMedia()

Method; mutes (silences) the audio currently playing (video and audio).

Parameters: None.

Returns: Nothing.

Example:

This example mutes media volume through a button with an instance name of "mute_btn":

ActionScript 2:

mute_btn.onRelease = function() {
   my_ssp.muteMedia();
}

ActionScript 3:

mute_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.muteMedia();
}

nextGalleryScreen()

Method; instructs the SlideShowPro Player to load the gallery screen after the current one in view (if available).

Parameters: None.

Returns: Nothing.

Example:

This example assigns nextGalleryScreen to the onRelease method of a movie clip with an instance name of "next_bttn":

next_bttn.onRelease = function() {
   my_ssp.nextGalleryScreen();
}

nextImage()

Method; instructs the SlideShowPro Player to change the display mode to manual and load the next image in queue (sequentially or randomly as set by the contentOrder property).

Parameters: None.

Returns: Nothing.

Example:

This example assigns nextImage to the onRelease method of a movie clip with an instance name of "next_bttn":

ActionScript 2:

next_bttn.onRelease = function() {
   my_ssp.nextImage();
}

ActionScript 3:

next_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.nextImage();
}

nextImageGroup()

Method; instructs the SlideShowPro Player to move the navigation links to the next group of options (if available).

Parameters: None.

Returns: Nothing.

Example:

This example assigns nextImage to the onRelease method of a movie clip with an instance name of "next_bttn":

ActionScript 2:

next_bttn.onRelease = function() {
   my_ssp.nextImageGroup();
}

ActionScript 3:

next_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.nextImageGroup();
}

pauseMedia()

Method; pauses playback in the media player.

Parameters: None.

Returns: Nothing.

Example:

This example pauses video/audio playback through a button with an instance name of "pause_btn":

ActionScript 2:

pause_btn.onRelease = function() {
   my_ssp.pauseMedia();
}

ActionScript 3:

pause_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.pauseMedia();
}

playMedia()

Method; starts or resumes playback in the media player.

Parameters: None.

Returns: Nothing.

Example:

This example starts video/audio playback through a button with an instance name of "play_btn":

ActionScript 2:

play_btn.onRelease = function() {
   my_ssp.playMedia();
}

ActionScript 3:

play_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.playMedia();
}

previousGalleryScreen()

Method; instructs the SlideShowPro Player to load the gallery screen before the current one in view (if available).

Parameters: None.

Returns: Nothing.

Example:

This example assigns previousGalleryScreen to the onRelease method of a movie clip with an instance name of "prevGallery_bttn":

ActionScript 2:

prevGallery_bttn.onRelease = function() {
   my_ssp.previousGalleryScreen();
}

ActionScript 3:

prevGallery_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.previousGalleryScreen();
}

previousImage()

Method; instructs the SlideShowPro Player to change the display mode to manual and load the previous image in queue (sequentially or randomly as set by the contentOrder property).

Parameters: None.

Returns: Nothing.

Example:

This example assigns previousImage to the onRelease method of a movie clip with an instance name of "prev_bttn":

ActionScript 2:

prev_bttn.onRelease = function() {
   my_ssp.previousImage();
}

ActionScript 3:

prev_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.previousImage();
}

previousImageGroup()

Method; instructs the SlideShowPro Player to move the navigation links to the previous group of options (if available).

Parameters: None.

Returns: Nothing.

Example:

This example assigns previousImage to the onRelease method of a movie clip with an instance name of "prev_bttn":

ActionScript 2:

prev_bttn.onRelease = function() {
   my_ssp.previousImageGroup();
}

ActionScript 3:

prev_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.previousImageGroup();
}

removeEventListener(event:String,listener:Function))

Method; removes an event listener from a component instance.

Parameters:

event A string that specifies the name of the event for which you are removing a listener.

listener A reference to the listener object or function that you are removing.

Returns: Nothing.

Example:

This example removes the onLoadXML event listener after it has been successfully called.

listenerObject = new Object();
listenerObject.onLoadXML = function(eventObject):Void {
	if (eventObject.data == true) {
		trace("XML file loaded!");
		my_ssp.removeEventListener("onLoadXML", listenerObject);
	}
}
my_ssp.addEventListener("onLoadXML", listenerObject);

setMediaVolume(volume:Number)

Method; assigns a new volume level for the media player. This affects both video and audio.

Parameters:

volume — The volume level. Must be a number between 0-100 with the ActionScript 2 version, 0-1 with the ActionScript 3 version.

Returns: Nothing.

Example:

This example assigns a new volume level through a button with an instance name of "maxVol_btn":

ActionScript 2:

maxVol_btn.onRelease = function() {
   my_ssp.setMediaVolume(100);
}

ActionScript 3:

maxVol_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.setMediaVolume(1);
}

setSize(width:Number,height:Number)

Method; resizes the SlideShowPro Player to the requested size. Numbers should be whole (no decimals). This method overrides any manual resizing performed on the component when placed on the stage.

Parameters:

width A number that indicates the width of the SlideShowPro Player, in pixels.

height A number that indicates the height of the SlideShowPro Player, in pixels.

Returns: Nothing.

Example:

This example resizes the slideshow component instance to 400 pixels wide and 200 pixels high:

my_ssp.setSize(400,200);

setStartAlbum(albumID:String,contentID:String)

Method; Instructs the SlideShowPro Player which album and (optional) image number the component should first display at startup. Note: This method will be overridden if permalinks? is set to "On", and the browser URL contains a valid permalink when the SWF is loaded. Using this method will also override startup? if set to "Startup".

Parameters:

albumID — The ID of the album to load.

contentID — The ID of the image (inside "albumID") to load.

Returns: Nothing.

Example:

This example assigns image #40 (in the navigation) inside the "nature" album:

my_ssp.setStartAlbum("nature",39);

toggleDisplayMode(mode:String)

Method; toggles the auto/manual playback of the SlideShowPro Player. May be used to stop and start automatic playback of a slideshow when assigned to a button. When requested without parameters, it acts as a toggle between playback modes.

Parameters:

mode:String [optional] - A string containing the requested mode change. Values include "Auto" (for auto-playback) and "Manual" (to stop).

Returns: Nothing.

Example:

ActionScript 2

This example assigns toggleDisplayMode to the onRelease method of a movie clip with an instance name of "play_bttn":

play_bttn.onRelease = function() {
   my_ssp.toggleDisplayMode();
}

This example instructs :stapi: to start auto-playback (if not in "Auto" already):

play_bttn.onRelease = function() {
   my_ssp.toggleDisplayMode("Auto");
}

ActionScript 3

This example is the same as the ActionScript 2 version, but updated for ActionScript 3 syntax.

function toggleSSP(e:MouseEvent):void {
	my_ssp.toggleDisplayMode();
}                              

play_bttn.addEventListener("click",toggleSSP);

toggleGallery()

Method; toggles the open / close state of the gallery.

Parameters: None.

Returns: Nothing.

Example:

This example assigns toggleGallery to the onRelease method of a movie clip with an instance name of "gallery_bttn":

ActionScript 2:

gallery_bttn.onRelease = function() {
   my_ssp.toggleGallery();
}

ActionScript 3:

gallery_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.toggleGallery();
}

toggleNav()

Method; toggles the open / close state of the navigation.

Parameters: None.

Returns: Nothing.

Example:

This example assigns toggleNav to the onRelease method of a movie clip with an instance name of "nav_bttn":

ActionScript 2:

nav_bttn.onRelease = function() {
   my_ssp.toggleNav();
}

ActionScript 3:

nav_bttn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.toggleNav();
}

unloadContent()

Method; removes the image or video currently displayed in the content area. It does not unload the album or gallery data currently loaded.

Parameters: None.

Returns: Nothing.

Example:

This example unloads the current image/video:

ActionScript 2:

my_btn.onRelease = function() {
   my_ssp.unloadContent();
}

ActionScript 3:

my_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.unloadContent();
}

unMuteMedia()

Method; returns volume to the level it was previously set to before the requisite muteMedia() method was called. If muteMedia() is not called beforehand, this method is ignored.

Parameters: None.

Returns: Nothing.

Example:

This example un-mutes media volume through a button with an instance name of "unMute_btn":

ActionScript 2:

unMute_btn.onRelease = function() {
   my_ssp.unMuteMedia();
}

ActionScript 3:

unMute_btn.addEventListener("click",afterClick);

function afterClick(e:MouseEvent):void {
   my_ssp.unMuteMedia();
}
Quick index:
:
Page last modified by tdominey on November 14, 2010, at 08:52 AM
© 2011 SlideShowPro. All Rights Reserved.