Progressbar not working

hello everybody,
I stuck in trouble again,i m using this code for my progress bar but it does not appear on “simulate download” too, it appears for a moment when it reaches nearby 100% & goto next frame
All my script is written on keyframe & no document class.
How can i get rid of such an unusual behaviour?

stop();
import fl.controls.*;

addEventListener(Event.ENTER_FRAME,prog);
function prog(eve:Event)
{
    prgb.setProgress(stage.loaderInfo.bytesLoaded,stage.loaderInfo.bytesTotal);
    
    perc.text=Math.round(stage.loaderInfo.bytesLoaded * 100/stage.loaderInfo.bytesTotal)+"% loaded";
    if(stage.loaderInfo.bytesLoaded==stage.loaderInfo.bytesTotal)
    {
        removeEventListener(Event.ENTER_FRAME,prog);
        removeChild(prgb);
        gotoAndStop(2);
    }