
SlideShowPro Player SWF has a number of public methods and events that can be accessed outside the SWF via ExternalInterface. This document will explain how to use them.
ExternalInterface is a utility through which Flash is able to communicate with Javascript in the web browser. Setting it to "true" allows interactivity like public methods and event listeners (more on those below) to function. ExternalInterface is off by default. To turn it on, add useExternalInterface with a value of "true" to the SWFObject flashvars variable, like so:
var flashvars = {
useExternalInterface: "true"
}
slideshowpro.swf is setup with ExternalInterface hooks so that any SlideShowPro method can be called through Javascript.
The best way to get a feel for how this works is to open the "js_methods.html" document in the "Examples/Javascript - Methods" folder. In the head you'll notice a series of Javascript methods named the same as the SlideShowPro Player methods to which they relate. They serve as a gateway through which you can call methods inside the SWF and pass parameters, if applicable.
Also in the head of the example document you'll see a getParameter() method. This is unique to the standalone version, and allows developers to return the value of any SlideShowPro parameter. The example includes this by popping up the version of the SlideShowPro instance in the SWF in an alert dialogue.
The SlideShowPro Player broadcasts events for changes in playback, gallery data, asset loading, and many more. You can use these to dynamically render captions, titles, or whatever else comes to your imagination.
To see how events work, we recommending viewing the source of the "js_listeners.html" document in the "Examples/Javascript - Listeners" folder. It contains a scrollable DIV element that updates (via Javascript) whenever gallery, album, or image event data is received.
The crux of event listening centers around the Javascript function onSlideShowProReady(). This method is automatically called by slideshowpro.swf when it is available for event listeners to be attached. Attaching events is easy. Here's an example:
function onSlideShowProReady() {
var ssp = document.getElementById("ssp");
ssp.addEventListener("albumData","onAlbumData");
ssp.addEventListener("galleryInfo","onGalleryInfo");
ssp.addEventListener("imageData","onImageData");
}
Simply assign addEventListener() to the ssp object, then pass in as attributes the name of the SlideShowPro Player event, followed by the receiving method in your Javascript.
For a complete list of all the SlideShowPro Player events you can listen to, click here.