Intend to start into the development of AS3, the previous AS2 code will gradually shift over, in the coding process may get some valuable information, I will share and discuss with you. There are better suggestions that can be made here. I do not guarantee that the method I am using is the best, nor does it guarantee that the code has no problems, and that, in this way, I am not responsible for any problems arising from the use of my Code. Also, please note that you do not use this code for commercial purposes, and if necessary, please contact me.
Loading external SWF files in AS2 generally uses Moviecliploader objects, and in AS3 it is more convenient to use loader. Loader inherits Displayobject, so you can load it directly into a displayobject using the Addchild method:
var loader:loader = new Loader ();
This.addchild (loader);
But then you load in a loader instead of loader object load in the SWF, so you need to take this way:
var loader:loader = new Loader ();
Loader.contentLoaderInfo.addEventListener (Event.complete, Completehandler);
Loader.load (New URLRequest ("lib.swf"));
function Completehandler (event:event) {
var _content:displayobject = event.target.content;
This.addchild (loader);
}
Also, be aware that you can't listen directly to the loader object to get the file loaded. Need to adopt loader.contentloaderinfo.
Point