Visit SlideShowPro.net  Community Forums
SlideShowPro Support Wiki
  
Flash component

Errors unloading the component

If you're using the ActionScript 3 version of the component and are loading a published SWF containing the component inside of a parent SWF using Loader.load(), you may see errors traced to the Output panel or continue to hear audio from a video or MP3 file. The reason is that ActionScript 3's Loader.unload() method doesn't remove from memory audio / video channels, timers, or events (unlike ActionScript 2). Here's what you can do to avoid these errors.

Publishing to Flash Player 10

If the SWF you are publishing is targeting Flash Player 10, use the Loader.unloadAndStop() method instead of Loader.unload() when removing the SWF that was loaded (containing SlideShowPro). This method was added by Adobe in Flash Player 10 to resolve this issue.

Publishing to Flash Player 9

If the SWF you are publishing is targeting Flash Player 9, there's some extra leg work involved. That player doesn't have the convenient unloadAndStop() method Flash Player 10 has, so we have to use our own version.

Step one: Edit FLA containing SlideShowPro

Open the FLA you use to publish SlideShowPro with, and add the following ActionScript to a keyframe:

function haltSSP():void {
   my_ssp.halt();
}

If your component instance is named something other than my_ssp, edit the name to the one you are using.

Step two: Edit parent FLA

Open the FLA for the parent SWF and edit your ActionScript so that it includes a call to the haltSSP() method before you call Loader.unload(). For example:

function unloadSSP():void {
	var loadClip:MovieClip = MovieClip(ldr.content);
	loadClip.haltSSP();
	ldr.unload();
}

Let's walk through the above line by line. The first inside the unloadSSP() method casts the content we loaded as part of a Loader instance to a variable of a MovieClip type. This allows us to access the timeline of our loaded content. We then call haltSSP() inside our loaded SWF, then follow that up with the unload() method to remove the loaded content from the parent.

You should now be able to load / unload a SWF containing SlideShowPro without any leftovers being seen / heard in your parent movie.

Note: For the ActionScript developers interested in learning more about Loader.unload's failure to unload, see this article by Grant Skinner explaining the bug from top to bottom.


Page last modified by tdominey on November 14, 2010, at 09:13 AM
© 2011 SlideShowPro. All Rights Reserved.