Experienced Greensockers, I could use some help. I developed a custom loader off of LoaderMax and SWFLoader. It works, but now I need to program a disposal function. I know the loader itself can use a disposal to clear ALL items within that loader, but is there a way to be able to call each individual swf and dispose. Not sure what use it'll have, but attached is my code.
package mil.af.trss367.loader.swfLoader
{
import com.greensock.events.LoaderEvent;
import com.greensock.loading.LoaderMax;
import com.greensock.loading.SWFLoader;
import com.greensock.loading.display.ContentDisplay;
import flash.display.MovieClip;
import flash.events.Event;
public class SwfLoader extends MovieClip
{
// Add Path of File into Array 'swf/LessonName.swf'
private var urls:Array = ["swf/LessonSWF.swf",
"swf/binaryClock.swf
"swf/AlertBoxes.swf"];
//Parse all of the urls, creating a LoaderMax that contains the correct type of loaders
private var queue:LoaderMax = LoaderMax.parse(urls, {name:"SWFLoader", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}) as LoaderMax;
public function SwfLoader()
{
// Add Lesson SWF's Here with name:Lesson + #
queue.append(new SWFLoader(urls[0], {name:"Lesson1"}));
queue.append(new SWFLoader(urls[1], {name:"Lesson2"}));
queue.append(new SWFLoader(urls[2], {name:"Alerts"}));
// Begin Loading
queue.load();
}
// Tracks Loading Progress
private function progressHandler(evt:LoaderEvent):void
{
trace("Progress: " + evt.target.progress.toFixed(2));
}
// Dispatches Event Once Loading is Complete
private function completeHandler(evt:LoaderEvent):void
{
trace(evt.target + " Is Complete!");
// Dispatches Event Listener to Stage When Load is Completed
this.dispatchEvent(new Event(Event.COMPLETE));
}
// Tracks Errors with Loader or Target
private function errorHandler(evt:LoaderEvent):void
{
trace("Error Occured With " + evt.target + ": " + evt.text);
}
// Removes All Instances of Loader and Children
public function dispose():void
{
// Call This When You Want To Unload/Dispose of the Loaded SWF
}
}
}