0

只是一个关于如何使预加载器向后动画的快速问题。因此,随着负载数量的增加,条形的宽度会减小。

这是我的代码

    onClipEvent (enterFrame) {
    loading = _root.getBytesLoaded();
    total = _root.getBytesTotal();
    if (percent == undefined) percent = 0;
    percent -= (percent-((loading/total)*100))*.25;
    per = int(percent);
    percentage = per+"%";
    loadBar._width = per*9.70;
    if (percent>99) {
        _root.gotoAndStop(2);
    }
}

非常感谢,

马特

4

2 回答 2

2

我认为这更简单:

onClipEvent (load) {
    onEnterFrame = function () {
        loading = _root.getBytesLoaded();
        total = _root.getBytesTotal();
        percent = Number(loading/total);
        this._xscale = (1-percent)*100;
        trace(percent);
        if (percent>=1) {
            //_root.gotoAndStop(2);
            delete (onEnterFrame);
        }
    };
}

它将在条件(百分比> = 1)变为真后停止。

于 2009-10-07T14:52:03.830 回答
1

换行

loadBar._width = per*9.70;

进入

loadBar._width = (100 -per)*9.70;

是一种快速而肮脏的方法

于 2009-10-07T11:44:35.847 回答