开发者

AS3 "Loader" progress immediately goes to 100%

If you go to http://moederdagontbijtplacemat.nl/ you will see a progress bar. The application is loading a fairly large SWF from the server using the Loader class. Strangely enough, the progress bar immediately goes to 100% (but the loading still takes a while after that). The code is below, but you'll see it's basically too simple to break.

---It has worked when the application was on a different server, so I though maybe the new server wasn't sending the size of the large SWF in the http headers. Firebug does show a progress bar though, so that is not the case, the information should be available.---

Update: That's actually incorrect, Apache does in fact not send the Content-Length the header. Going to开发者_开发问答 look into that. :EndUpdate

It also works when I run the loader swf locally and change the URL (new URLRequest("Placemat.swf")) to the absolute URL of Placemat.swf on the server.

        var l:Loader = new Loader();
        addChild(l);
        l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, function(e:ProgressEvent) {
            s.setProgress(e.bytesLoaded/e.bytesTotal);
            trace(Math.round(100 * e.bytesLoaded/e.bytesTotal), "%");
        });
        l.contentLoaderInfo.addEventListener(Event.COMPLETE, function() {
            removeChild(s);
        });

        l.load(new URLRequest("Placemat.swf"));


The loader bar functioned correctly when i visited the website.

the swf might just be in your browser cache, try clearing your cache


Fixed, Apache was gzipping and not sending the Content-Length header.

.htaccess:

SetEnv no-gzip dont-vary
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜