Both of these should work. If you want to load a different object the former object is replaced with the new, no need to remove. If you just want to unload then use
swfHolder.unload();
This was buggy in earlier Flash players but is now working.
Example 1:
var swfHolder:Loader = new Loader();
function loadSwf (target:String):void
{
if(swfHolder!=null)
{
removeChild(swfHolder);
}
addChild (swfHolder);
swfHolder.load (new URLRequest(target));
}
Example 2:
var swfHolder:Loader = new Loader();
addChild (swfHolder);
function loadSwf (target:String):void
{
swfHolder.load (new URLRequest(target));
}




Reply With Quote
