Flash – AS3 : How to load external SWF file into a Parent SWF file in ActionScript 3.0 (AS3)?

flash-logoSWF files are loaded using the Loader class. To load an external SWF file, you can follow the steps below.

  • Create a new URLRequest object with the url of the file.

  • Create a new Loader object.

  • Call the Loader object’s load() method, passing the URLRequest instance as a parameter.

  • Call the addChild() method on a display object container (such as the main timeline of a Flash document) to add the Loader instance to the display list.

Sample code in ActionScript 3.0 :

var request : URLRequest = new URLRequest(“http://www.yoursite.com/file.swf”);
var loader:Loader = new Loader()

You can load external SWF in movieClip or directly on your flash timeline.