开发者

preloader simulation white screen: AS3

currently I'm having some problems with my preloader.

I have an as3 class website with the following code:

public function Website() {

        addEventListener(Event.ENTER_FRAME, PreloaderStart);
    }

    private function PreloaderStart(e:Event):void {
        var bt:int=loaderInfo.bytesTotal;
        var bl:int=loaderInfo.bytesLoaded;
        trace(bl/bt);
        var pt:int=Math.round(100*bl/bt);
        preloaderMC.loadInfo.text="loading "+pt+"%";
        if (bl==bt) {
            removeEventListener(Event.ENTER_FRAME, PreloaderStart);
            PreloaderOnComplete();
        }
    }
    private function PreloaderOnComplete():void {
        trace("loaded");
        buildUI();
    }

I painted my stage black and when I simply run my flash file it traced "loaded" so everything is loaded well a开发者_JAVA技巧nd it builds the UI. But when I simulate by pressing ctrl+ enter twice I get a white screen and after about 10 sec. (my swf is 1mb and it simulates at 100kbs) it displays the preloader instantly at 100% and loads my UI. So my text doesn't change from 0% -> 100% but I just get 100% when everything is loaded.

if anyone can help me out, I would be thankfull.

Regards


Have a look at the first frame with the bandwith profiler. If you've got a lot of things to load, you might to move them on the 2nd frame, and leave as few things as possible for the first frame.

If you look in the bandwidth profiler and simulate a download you should see that the preloader or any content shows up only after the 1st frame is loaded.

You might need to set the actionscript settings' export frame to 2, depending on what classes/components you're using.

HTH


If your buildUI call references any other classes (which it probably does), all that code will also be loaded on the first frame.

Assuming you're using Flash and not Flex Builder, your buildUI() call would better be placed on frame 2. And do what George wrote about the Actionscript being exported to frame 2.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜