# Preloader on Frame 1 of main movie

**URL:** <https://forum.kirupa.com/t/preloader-on-frame-1-of-main-movie/246063>\
**Category:** flash\
**Created:** [December 6, 2007, 6:45pm UTC](https://forum.kirupa.com/t/preloader-on-frame-1-of-main-movie/246063 "2007-12-06T18:45:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elburrodiablo](https://avatars.discourse-cdn.com/v4/letter/e/49beb7/32.png) [@elburrodiablo](https://forum.kirupa.com/u/elburrodiablo)\
**Post date:** [December 6, 2007, 6:45pm UTC](https://forum.kirupa.com/t/preloader-on-frame-1-of-main-movie/246063/1 "2007-12-06T18:45:21Z")

</div>

Below you’ll see the code for the preloader I’ve been using for the past few weeks. It works fine if I want to have two separate SWFs (the main SWF, and the preloader SWF.)

Unfortunately, for the current project I am working on, it is necessary for the preloader to be part of the main file. I would like to modify the code below a bit, so that I can place it on frame 1, which would then advance to frame 2 when the SWF is fully loaded.

Any help would be greatly appreciated.

```auto
 
var req:URLRequest = new URLRequest("tour.swf");
var loader:Loader = new Loader();
loader.load(req);
addChild(loader);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
function checkProgress(p:ProgressEvent):void {
   var percent:int = (p.currentTarget.bytesLoaded / p.currentTarget.bytesTotal) * 100;
   mLoadBar.scaleX = percent;
}

```
