白色preloader屏幕? (AS3)屏幕、白色、preloader

2023-09-08 14:58:15 作者:放荡的人生

我做了preloader,它工作正常,但屏幕是白色的,直到大约75%加载,该文件是令人难以置信的小(〜10KB),所以我在想,如果它是因为这一点,当我使用为测试它一个1.4MB的图像只有白色的,直到大约3%(这我是罚款)。

您可以在这里找到一个.swf: http://www.newgrounds.com/dump/项目/ f55c55059d9b3bcbec03c08c492ab739

在帧1 code:

 停止();
的addEventListener(Event.ENTER_FRAME,frameChecker1);
功能frameChecker1(事件:事件):无效{
跟踪(框中输入。);
VAR装:数= this.loaderInfo.bytesLoaded;
VAR总:数= this.loaderInfo.bytesTotal;
VAR%的:数=加载/总;
VAR percentRounded:UINT =%的* 100;
loadingBar.scaleX =个百分点;
textLoading.text = percentRounded +%;
如果(总装==){
    buttonPlay.alpha =个百分点;
}
其他 {
    buttonPlay.alpha =百分之/ 2;
}
如果(总装==){
    removeEventListener(Event.ENTER_FRAME,frameChecker1);
}
}
buttonPlay.addEventListener(MouseEvent.CLICK,playClick);
功能playClick(事件:MouseEvent)方法{
        玩();
    }
 

解决方案

一帧需要被完全加载它是可见的。如果有动态对象(符号,你可以用code连接),你将不得不在其他地方出口(帧2)。你可以进入资料库>你的符号>右键点击>属性,取消出口在第1帧。

出现黑白屏幕

现在你必须手动的地方放置这些对象。通常你只是倾倒在画面中两条所有动态对象,你从来没有真正使用该框架为别的。这将保证所有的对象都在帧的两个装,让你的第1帧,以显示进度。

I've made a preloader, it works fine, except the screen is white until about 75% loaded, the file is incredibly small (~10kb) so I was wondering if it's because of that as when I used a 1.4mb image for testing it was only white until about 3% (which I was fine with).

You can find a .swf here: http://www.newgrounds.com/dump/item/f55c55059d9b3bcbec03c08c492ab739

Code on frame 1:

stop();
addEventListener(Event.ENTER_FRAME, frameChecker1);
function frameChecker1(event:Event):void {
trace("Frame entered.");
var loaded:Number = this.loaderInfo.bytesLoaded;
var total:Number = this.loaderInfo.bytesTotal;
var percent:Number = loaded/total;
var percentRounded:uint = percent * 100;
loadingBar.scaleX = percent;
textLoading.text = percentRounded + "%";
if (total == loaded) {
    buttonPlay.alpha = percent;
}
else {
    buttonPlay.alpha = percent/2;
}
if (total == loaded) {
    removeEventListener(Event.ENTER_FRAME, frameChecker1);
}
}
buttonPlay.addEventListener(MouseEvent.CLICK, playClick);
function playClick (event:MouseEvent){
        play();
    }

解决方案

First frame needs to be fully loaded for it to be visible. If you have dynamic objects (symbols you can attach with code) you will have to export them elsewhere (frame 2). You can go into Library > "Your Symbol" > Right Click > Properties, and uncheck "Export in frame 1".

Now you'll have manually place these objects somewhere. Usually you just dump all dynamics objects on frame two, and you never really use that frame for anything else. This will guarantee all your objects are loaded on frame two, allowing your frame 1 to display the progress.

 
精彩推荐