A
A
Alex Mustdie2015-05-26 22:02:35
Adobe Flash
Alex Mustdie, 2015-05-26 22:02:35

How to monitor script loading progress on AS3?

Good day!
There is such a modest script (AS3):
7gCy0TM.png
Actually, I need to track the loading process of this script (0% loaded, 50%..) with trace output, for example. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-06-30
@Onni

In general, it should be

var reqeust: URLRequest = new URLRequest("https://toster.ru/q/219928");
var loader: URLLoader = new URLLoader();
loader.addEventListener(ProgressEvent.PROGRESS, function(e: ProgressEvent): void {
    trace(e.bytesLoaded + "/" + e.bytesTotal);
});

loader.load(request);

But specifically for this page, as well as for your script, e.bytesTotal will be equal to 0, since the web server does not return the "Content-Length" header in the header and we do not know how much the size of the downloaded resource will be. If you try to upload, for example, a photo in the same way, then the size will be known in advance for it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question