External Preloader Error #1009

I used an external preloader to call a swf is totally calling all the objects and functions through class, and there is nothing on the stage and timeframe.

It shows TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main()

Isit because i must put something on the stage or timeline for it to load??


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

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

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