How to in AS3 (loadMovie)?


Learning AS3… In AS2 you can do a simple load external swf like this:

(for a loader_mc on stage with instance name of “loader_mc”)


How would you do the same in AS3?

Thanks a bunch, Greg


var loader:Loader = new Loader();


loader.load(new URLRequest(“startAni.swf”));

Hope that helps.


private function loadSWF(url:String):void {
	var request:URLRequest = new URLRequest(url);
	var loader:Loader = new Loader();
	loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onAssetLoaded, false, 0, true);

private function onAssetLoaded(evt:Event):void {

	var loader:Loader = as Loader;



I’m in the same AS2 to AS3 boat… to expand on that question, two sub-questions:

  1. How then do you unload it?
    I’ve been attempting to do it (unsuccessfully) this way:

  2. How would you load/undoad multiple swf’s when using multiple movieclip buttons (on the main stage, not in the loaded swf… btn_1 to load swf_1, btn_2 to load swf_2, etc), when the button’s AS code is inside the movieclip, rhater than the main stage?


It’s a pain to unload movie in as3, FYI: