# Preloading Loses Stage

**URL:** <https://forum.kirupa.com/t/preloading-loses-stage/254967>\
**Category:** flash\
**Created:** [March 17, 2008, 7:55pm UTC](https://forum.kirupa.com/t/preloading-loses-stage/254967 "2008-03-17T19:55:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrZoop](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@DrZoop](https://forum.kirupa.com/u/DrZoop)\
**Post date:** [March 17, 2008, 7:55pm UTC](https://forum.kirupa.com/t/preloading-loses-stage/254967/1 "2008-03-17T19:55:21Z")

</div>

I am attempting to use one SWF to load another, acting as a preloader. The loader works fine by itself. The content works fine by itself. When you have the loader load the content, the content.stage is null. How do I fix this?

I stole the preloading code from Senocular, because it was the clearest example I found. However, I still don’t comprehend what makes the content SWF appear on top of the loader. Where is the loaded content initialized? It appears to be done automatically.

```auto

package 
{
 import flash.display.MovieClip;
 import flash.events.ProgressEvent;
 import flash.display.Loader;
 import flash.display.LoaderInfo;
 import flash.events.Event;
 import flash.text.TextField;
 import flash.net.URLRequest;
 
 
 public class Preloader extends MovieClip
 {
  var request:URLRequest = new URLRequest("Flash Engine 2.swf");
  var loader:Loader = new Loader();
  
  public function Preloader():void
  {
   loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
  
   loader.load(request);
  }
  function loadProgress(event:ProgressEvent):void 
  {
   var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
   percentLoaded = Math.round(percentLoaded * 100);
   txtLoading.text = "Loading... " + percentLoaded + "%";
   trace("Loading: "+percentLoaded+"%");
  }
  function loadComplete(event:Event):void 
  {
   trace("Complete");
   addChild(event.currentTarget.content);
  }
  
 }

```

Cheers.

(I literally had a nightmare about ActionScript this past Saturday.)
