# Convert AS3 loader to AS2

**URL:** <https://forum.kirupa.com/t/convert-as3-loader-to-as2/316493>\
**Category:** flash\
**Created:** [November 23, 2010, 2:02pm UTC](https://forum.kirupa.com/t/convert-as3-loader-to-as2/316493 "2010-11-23T14:02:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cantaloupe](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@cantaloupe](https://forum.kirupa.com/u/cantaloupe)\
**Post date:** [November 23, 2010, 2:02pm UTC](https://forum.kirupa.com/t/convert-as3-loader-to-as2/316493/1 "2010-11-23T14:02:32Z")

</div>

I’ve been using the following code to load swfs with a simple bar preloader. However, I’ve now got a bunch of AS2 swfs to add loaders to and this code wont work.

Is there either:

a) a way to convert this code to as2?

or

b) a workaround that will allow me to load the as2 files into the container with the existing code?

Any help greatly appreciated!

(Here’s the code)

```auto

var myMovie:Sprite;
 
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop, false, 0, true);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done, false, 0, true);
l.load(new URLRequest("movie.swf"));
 
function loop(e:ProgressEvent):void
{
  var perc:Number = e.bytesLoaded / e.bytesTotal;
  percent.text = "Loading " + Math.ceil(perc*100).toString()+"%";
  bar_mc.scaleX = perc; 
}
 
function done(e:Event):void
{
  removeChild(percent);
  percent = null;
 
  myMovie = Sprite(l.content);
 
  addChild(myMovie);
 
  l.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loop);
  l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
  l = null;
}

```

The reason I cant use a simple AS2 loader is that I need to make sure the whole swf has loaded, including library items.
