Loader class

I have been using flash for several years and one thing I do a lot is load swf files into movie clips on the stage. I usually call these movie clips on the stage “containers”. Well, now I’m struggling to learn actionscript 3 and I’m curious…how can I load external swf files into already existing movie clips on the stage?

Thanks in advance!

:expressionless:

well in as3, you would use the Loader class to load external files, such as bitmaps and SWFs. first off, you need to create the loader object. then load the file using URLRequest and add the loader object as a child to your on stage movieclip to display it:

[AS]var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(“movie.swf”);
loader.load(request);
// use addChild() to use your movieclip as the Loader object’s container:
mc.addChild(loader);
[/AS]

Thank you so much for your help! It worked like a charm! I’m really trying to learn AS3 after ignoring it for almost 2 years. I am really set in my ways of doing things in AS2 so the migration is kind of difficult.

[quote=Exodar;2327391]well in as3, you would use the Loader class to load external files, such as bitmaps and SWFs. first off, you need to create the loader object. then load the file using URLRequest and add the loader object as a child to your on stage movieclip to display it:

ActionScript Code**:**[COLOR=#000000]**

var**[/COLOR] loader:Loader = [COLOR=#000000]new[/COLOR] LoaderCOLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] request:URLRequest = [COLOR=#000000]new[/COLOR] URLRequestCOLOR=#000000[/COLOR];
loader.[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#808080]// use addChild() to use your movieclip as the Loader object’s container:[/COLOR]
mc.[COLOR=#000080]addChild[/COLOR]COLOR=#000000[/COLOR];

[/quote]