Problem with uploader

Hi,

I get this message error when adding a preloader to the movieclip I am working on…

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at WebCandy_fla::MainTimeline/frame2()
at flash.display::MovieClip/nextFrame()
at WebCandy_fla::MainTimeline/updatePreloader()

I tested the movie clip with this code and it worked fine:

stop();
//preloader
loaderInfo.addEventListener(ProgressEvent.PROGRESS, updatePreloader);

function updatePreloader(evtObj:ProgressEvent):void
{
//container for the progress of the site (download)
var percent:Number = Math.floor((evtObj.bytesLoaded*100)/evtObj.bytesTotal);
preloader_txt.text = percent+"%";

As soon as I added this part it started giving me the error message:

if (percent==100){
nextFrame();
}

}

Does anybody know why, I am quiet new to actionscript.

Thank you