ssMovieClipLoader Overview

ssMovieClipLoader is not available from ActionScript 3. For ActionScript 3 projects see Flash's built-in Loader class, or for secure loading see ssURLLoader.

ssMovieClipLoader is a direct replacement for the Macromedia Flash MX 2004 MovieClipLoader class. The functionality is nearly identical. The benefits to having this class for both Flash MX and MX 2004 users prompted it's inception, as well as to provide the added functionality of loading SWFs and/or JPGs from the internal layout of a SWF Studio-built EXE.

There is one property in this class that does not appear in the MovieClipLoader class: timeout. timeout is necessary to trigger the onLoadError event if the bytes loaded data does not change for a period of time, typically an indication that a remote connection has gone down during transfer. This differs from MovieClipLoader where the onLoadComplete is eventually triggered if the connection is severred. The timeout property may only have to be altered if connections are typically slow for a given situation and/or data delays are acceptable.

For more information on the Flash MX 2004 MovieClipLoader class check out the Macromedia LiveDocs


Examples:

Here we want to load a SWF into a movieclip that might be part of some navigation for an application. We want to inform the user of the status of the loading of the file and when we're done we want to move the playhead for that movieclip to a particular location.

We make an instance of ssMovieClipLoader and a new object and add the object as a listener. We write the event handlers on the object. In this case we only want to know about the onLoadProgress event, for informing the user of a navigation movieclip's load status, and the onLoadInit event, which will tell us when we can begin manipulating the SWF.

var my_mcl = new ssMovieClipLoader();

var mclListener_obj = new Object();
mclListener_obj.onLoadProgress = function (target_mc,loadedBytes,totalBytes)
{
    _root.progressBar_mc._xscale = Math.round((loadedBytes / totalBytes) * 100);
}
mclListener_obj.onLoadInit = function (target_mc)
{
    target_mc.gotoAndStop('StartNav');
}

my_mcl.addListener(mclListener_obj);

my_mcl.loadClipSecure('nav.swf',leftNav_mc);