
In a timeline layer above your SSP instance, add a Movie Clip named "preload_mc". Inside the Movie Clip create a dynamic text instance (preload_txt) and a simple, rectangular Movie Clip (preload_bar).
So, the heiarchy of the movie is this:
- SSP (my_ssp)
- preload_mc
-- preload_txt
-- preload_bar
Then, create a new timeline layer above that and name it "actions". Add the following to the empty keyframe for that layer:
// Hide preload_mc until we need it
preload_mc._visible = false;
// Set the xscale of the preload bar to zero
preload_mc.preload_bar._xscale = 0;
// Create a new listener object
var sspListenUp = new Object();
// Define what should happen when the preloadStart event fires
sspListenUp.onPreloadStart = function(eventObject):Void {
// If preload_mc is not visible and the data returned is under 100, make the preloader visible (See note below)
if (preload_mc._visible == false && eventObject.data < 100) {
preload_mc._visible = true;
}
// Set the text box to display the current progress of the preload
preload_mc.preload_txt.text = eventObject.data;
// Set the preload bar to scale to show progress
preload_mc.preload_bar._xscale = eventObject.data;
};
// Preloading is done, what to do now?
sspListenUp.onPreloadEnd = function(eventObject):Void {
// Hide preload_mc and reset the preload_bar scale
preload_mc._visible = false;
preload_mc.preload_bar._xscale = 0;
};
// Hook the listeners up to your SSP instance
my_ssp.addEventListener("onPreloadStart", sspListenUp);
my_ssp.addEventListener("onPreloadEnd", sspListenUp);
The reason we check to see if the data is under 100 in the first line of the of the preloadStart handler is that once in a while the event can sometimes return a number above 100 right at the beginning of the preloader, then would start with 0. Adding this line makes sure it only displays when the preloader is returning valid data.
Publish a movie, and test it online (where there's latency for the preloader to use). You should see your preloader functioning just like the one embedded inside SSP.

