# Loading SWF files easy

**URL:** <https://forum.kirupa.com/t/loading-swf-files-easy/327174>\
**Category:** flash\
**Created:** [February 10, 2012, 5:34pm UTC](https://forum.kirupa.com/t/loading-swf-files-easy/327174 "2012-02-10T17:34:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrvoje986](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@hrvoje986](https://forum.kirupa.com/u/hrvoje986)\
**Post date:** [February 10, 2012, 5:34pm UTC](https://forum.kirupa.com/t/loading-swf-files-easy/327174/1 "2012-02-10T17:34:24Z")

</div>

Hi i am creating a shooting game in AS3,my problem is that i cant do what i used to in AS2.  
In AS2 i used to have many SWF files for one game(main.swf, level1.swf, level2.swf …),main.swf would open first and i was jumping from one SWF file to other using

```auto

[COLOR=#993300]unloadMovieNum[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"level1.swf"[/COLOR][COLOR=#000000])[/COLOR];
 [COLOR=#993300]loadMovieNum[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"level2.swf"[/COLOR], [COLOR=#000000]1[/COLOR][COLOR=#000000])[/COLOR];

```

and that is all you needed in AS2 game when you finish level and you want to go to next level, but in AS3 things are little bit complicated.  
I only know how to LOAD level1.swf into main.swf but when i want to UNLOAD  
level1.swf and jump to level2.swf nothing works for me.

Here is the code what i used

main.swf: you click a button named “my\_mc” and level1.swf loads

```auto

[COLOR=#993300]function[/COLOR] newvid[COLOR=#000000]([/COLOR]event:MouseEvent[COLOR=#000000])[/COLOR] [COLOR=#000000]{
[/COLOR] [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]"you clicked me"[/COLOR][COLOR=#000000])[/COLOR];
 [COLOR=#993300]var[/COLOR] loadit = [COLOR=#993300]new[/COLOR] Loader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
 addChild[COLOR=#000000]([/COLOR]loadit[COLOR=#000000])[/COLOR]; 
loadit.[COLOR=#993300]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]new[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#0000FF]"level1.swf"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
 [COLOR=#000000]}[/COLOR] 
my_mc.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]MOUSE_DOWN[/COLOR], newvid[COLOR=#000000])[/COLOR];

```

level1.swf:what i would want is when i click a button named load\_btn it unloads level1.swf and loads level2.swf

```auto

[LEFT]load_btn.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000000]MOUSE_DOWN[/COLOR], loadlevel2[COLOR=#000000])[/COLOR];

[/LEFT]

```

This is probably easy for AS3 users but i am pretty new in all this so any help or idea would be appreciated.
