AS3 monitor progress main swf loading (preload)

Never had any problem with loading and monitoring loading progress of external files.
Having some problems on monitoring progress of downloading of the main swf file…


In document class constructor:
I add listeners to loaderInfo of document class…


loaderInfo.addEventListener(Event.OPEN,openListener);
loaderInfo.addEventListener(ProgressEvent.PROGRESS,progressListener);
loaderInfo.addEventListener(Event.COMPLETE,completeListener);

and I create the object I’d like to use to visualize progression
(using a textfield now, but also tried dynamically drawn graphic bar)

loaderStatus = new TextField(); 

private function progressListener (e:ProgressEvent):void 
{
    trace("progress");
            
    var percent:int = e.bytesLoaded / e.bytesTotal * 100;
    loaderStatus.text = "Loading: " + percent + "%";           
}
        
private function completeListener (e:Event):void 
{
    e.target.removeEventListener(ProgressEvent.PROGRESS, progressListener);
    e.target.removeEventListener(Event.COMPLETE, completeListener);
    trace("complete");
    stage.removeChild(loaderStatus);
}

the progress and complete listeners give feedback through tracing.
:thumb:
the open listeners doesn’t give feedback…
that’s why I’ve moved the creation of the ‘progression visualizer’
(whatever it is) inside the constructor of the document class…

I don’t get it…
why we have a loaderInfo property accessible in root/document class
if it’s useless to track the downloading of the main file
:ponder:

I’ve tried to search this and other forums
but I’ve find only info about preloaders in AS2, preloaders for external content
essential actionscript 3.0 from colin moock
has info about making a preloader in flash authoring environment
but it’s using frame scripts…

shouldn’t be possible to manage all the preloader stuff for the main clip
directly from the document class? :h:
I know that I’m new to all this AS3 world but…

hope someone will read this
have a medium-size project and all my initial assets and class
have a dimension of approximately 300K so I absolutely need
a preloader for the main file

Any hints, suggestions, pointers are really appreciated
Thanks
Jo

I don’t know if it still helps bit somehow it works here… placed on first frame (which has no content)

stop();

this.loaderInfo.addEventListener(ProgressEvent.PROGRESS,onMainLoadProgress);
this.loaderInfo.addEventListener(Event.COMPLETE,onMainLoadCompletes);


function onMainLoadProgress(event:ProgressEvent):void {
    trace(event.bytesLoaded);
}

function onMainLoadCompletes(event:Event):void {
    //continue to next frame
}