How to load SWF into MovieClip in AS3

Loading swf in AS3 is not as simple as AS2 loadMovie(“file.swf”, mc_name). You first have to define a loader class and URLRequest path pointing to the external swf file location.

This example uses a extranl file by the name of “loadSWF_File.swf” to be loaded in to our main flash movie clip with the instaints name “holderLMC”. We also add a on complete listener to our loader class to be use for notifying us that the swf has been imported and is ready for action.

var swfLoader:Loader = new Loader();
var bgURL:URLRequest = new URLRequest("loadSWF_File.swf");
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);
function loadProdComplete(e:Event):void {
	trace("file loaded");

16 Responses

  1. Wondering1 says:

    How would I have it load into that mc(holderLMC) if it was doing it from inside another mc…? //such as a drop down menu with submenus… I made four sub btns and did a test… this is what is done. The submenu is able to open a web page in another window on one sub btn. the 2nd is able to open a web page in the same window. The 3rd one is able to load an swf onto the stage..the fourth one im trying to load it into a movie clip. I already understand how to load it into a movie clip from the main stage… just not while in another mc. please advise. Thank you.

  2. chris says:

    So how do you unload that same movieclip?

  3. Entiendo con claridad el codigo pero me gustaria me facilites un ejemplo de como lo manejas porfavor estoy realizando un juedo con mas de 2 swf

  4. Gracci. This worked.

  5. MO says:

    Great! Thank you…..

  6. Luke says:

    hi i got it to load the my swf but not inside the movie clip?

  7. Luke says:

    sorry, what i mean is its inside the MC but its not scaling the Swf to fit inside it!

  8. tb99 says:

    I am trying to load an swf into my main flash movie. The external swf has some buttons and a datagrid. When the swf is loaded to the main, the button labels and datagrid column names are lost. It seems the buttons in the external swf are interfering with the buttons in the main flash movie. Any recommendations on how to fix this problem? Thanks!!!

  9. lana says:

    How can you specify a certain frame from the movie (loadSWF_File.swf) you just loaded?

  10. Its quite impressive script. but should be more nicer if have fla project file too..

  11. Don says:

    I am trying to load an AS2 swf file with video and it uses the SteelExternalAll skin but the skin doesn’t want to load and so the video doesn’t play. Any ideas?

  12. Walied says:

    It’s nice, thank you. I see that swf appear but in the right bottom of workspace, how can in control it with this code

  13. mido says:

    It’s great tut

    but i want to load external swf but it’s give me error

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Main()[E:\MacMenuSource\]

    the code is


    import flash.display.Sprite;




    import flash.display.Loader;

    public class Main extends Sprite{

    private var _loader:Loader = new Loader();

    public function Main():void{


    mc_gear.addEventListener ( MouseEvent.CLICK , buttonClick );





    //_loader=new Loader();



    private function buttonClick(e:MouseEvent):void{

    var url:URLRequest=new URLRequest();


    case “mc_star”: url.url=”bg2.swf”; break;

    //case “mc_gear”: url.url = “bg2.swf”; break;

    //case “mc_apple”: url.url=”bg4.swf”; break;

    //case “mc_photo”: url.url=”bg5.swf”; break;

    //case “mc_buy”: url.url=”bg6.swf”; break;

    //case “mc_contact”: url.url=”bg7.swf”; break;






    the line 23 is


    if you want to see the fla download it from this link

    thank you

Leave a Reply