Preloader for .as file

Hi all,

I want to write a code for .as file.

I wrote:

this.addEventListener(ProgressEvent.PROGRESS, loading);

function loading(event: ProgressEvent):void {

var total:int=this.stage.loaderInfo.bytesTotal;
var loaded:int=this.stage.loaderInfo.bytesLoaded;

var precent:int=(loaded/total)*100);

if(precent==100){
trace(“preloader finished”);
}
}

Though i changed the ProgressEvent to Event.ENTER_FRAME it is not showing the text box output.

please help me.

-soha