Null object using preloader

I have a swf that is called preloader.swf…All it does is preload my main movie. The code for my preloader is:


stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("content.swf"));

function loop(e:ProgressEvent):void
{
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    preloader.txt.text = Math.ceil(perc*100).toString();
}

function done(e:Event):void
{
    removeChildAt(0);
    preloader.txt = null;
    addChild(l);
}

and my content.swf contains:


stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(e:Event):void
{
    header.width = stage.stageWidth + 100;
    bgClip.y = 0;
    bgClip.x = 0;
    bgClip.width = stage.stageWidth;
    bgClip.height = stage.stageHeight;
    bgClip.scaleX >  bgClip.scaleY ? bgClip.scaleY = bgClip.scaleX : bgClip.scaleX = bgClip.scaleY;
}
resizeHandler(null);

I am assuming the null reference is talking about the references to stage. I am getting this error:


TypeError: Error #1009: Cannot access a property or method of a null object reference. at content_fla::MainTimeline/frame1()

What am I doing wrong here?