# Loader class

**URL:** <https://forum.kirupa.com/t/loader-class/260553>\
**Category:** Uncategorized\
**Created:** [May 16, 2008, 5:49pm UTC](https://forum.kirupa.com/t/loader-class/260553 "2008-05-16T17:49:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tslawrence](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@tslawrence](https://forum.kirupa.com/u/tslawrence)\
**Post date:** [May 16, 2008, 5:49pm UTC](https://forum.kirupa.com/t/loader-class/260553/1 "2008-05-16T17:49:17Z")

</div>

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!

😑

---

<div class="post-metadata">

**Author:** ![Exodar](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@Exodar](https://forum.kirupa.com/u/Exodar)\
**Post date:** [May 17, 2008, 1:03am UTC](https://forum.kirupa.com/t/loader-class/260553/2 "2008-05-17T01:03:05Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![tslawrence](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@tslawrence](https://forum.kirupa.com/u/tslawrence)\
**Post date:** [May 19, 2008, 3:23pm UTC](https://forum.kirupa.com/t/loader-class/260553/3 "2008-05-19T15:23:18Z")

</div>

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]
