Jump to content
Search Community

unload previous SWF

andresapitt test
Moderator Tag

Recommended Posts

not sure if this is the right class to do this. but i am loading different swf using SWFLoader(). the problem is that each swf load on top of the previous one. so i am looking to unload the previous one before uploading the next one.

Any ideas?

 

function loadSWF(path:String):void {

setChildIndex(preloader_mc,numChildren - 1);
var filename:String = path;
// Find the location of the period.
var extensionIndex:Number = filename.lastIndexOf( '.' );
// The extension-less filename ("mydocument") is everything before the period.
var extensionless:String = filename.substr( 0, extensionIndex ); 
trace( "The filename is " + extensionless );
	loader = new SWFLoader("./"+path, {name:extensionless, container:container_mc, x:50, y:87, onInit:initHandler, onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler, onOpen:onOpenHandler, estimatedBytes:9500});

 //begin loading
	loader.load();

previousMc=extensionless;
}

Link to comment
Share on other sites

Hi,

 

the reason for the stacking is because you are using the same loader multiple times with the same container. nothing wrong with that.

 

you can use SWFLoader's unload() or load() methods to flush out previously loaded content.

 

try

loader.load(true) // load and flush previously loaded content

 

More info on SWFLoader methods here: http://www.greensock.com/as/docs/tween/ ... hodSummary

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...