预加载器动画不起作用

时间:2014-12-06 10:15:51

标签: actionscript-3 class preloader

我正在为我的游戏制作一个预加载器我将我的影片剪辑导出到第2帧,除了那些与预加载器图形有关的内容在我的第1帧中我有这个代码

import flash.events.ProgressEvent;
stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS , onProgress);
function onProgress(e:ProgressEvent):void
{
    progbar.width = (this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 398;
    jot.x = progbar.x + progbar.width;     //jot is the name of loader label it moves with the
    jot.y = progbar.y;                     //end point of progbar
    jot.loadtext.text = String(Math.round(progbar.width / 398 * 100)) + " %"; // labale has text inside it
    if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal)
    {
        gotoAndStop(2);
    }
} 

并且在任何给定时间酒吧达到的地方我想放一个冒泡的效果我属于一个类 Spark 这就是我的火花类的样子

public class Spark extends MovieClip
    {

        private var pl:Array = new Array();
        private var t:int = 0;
        public function Spark()
        {
            this.addEventListener(Event.ENTER_FRAME , onEnter);
        }
        private var l:int = 0;
        private var i:int = 0;
        private function onEnter(e:Event)
        {
            t++;
            if (t == 2)
            {
                t = 0;
                var p:P = new P();   // P is the single particle
                addChild(p);
                pl.push(p);         // pl is the array to hold particles
                p.width = Math.random() * 20 + 5;
                p.height = p.width;
                p.vx = Math.random() * 4 - 2;
                p.vy = Math.random() * 4 - 2;
            }
            l = pl.length;         //storing length of array to save performance
            for (i=0; i< l; i++)      
            {
                pl[i].alpha -=  0.05;
                pl[i].y +=  pl[i].vy;
                pl[i].x +=  pl[i].vx;
            }
            //removeing completely transparent particles
            for (i=0; i< l; i++)
            {
                if (pl[i].alpha < 0.02)
                {
                    removeChild(pl[i]);
                    pl.splice(i,1);
                    break;
                }
            }
        }
    }

在舞台上的第一帧Spark实例中添加了与progbar对齐的代码 但是没有任何事情只发生在酒吧里,但气泡并没有从它的结尾出来。 我尝试检查并取消选中第2帧&#34;

中的spark类&#34;导出

我将类Spark的拖动实例命名为spark1 当我将这个代码添加到第1帧时,我感到很沮丧

if(spark1 != null)
{
   trace("its fine");
} else {
  trace("something weird");
}

我得到了其他声明。怎么可能

1 个答案:

答案 0 :(得分:0)

我找到了解决方案

  1. 我去了File&gt;动作脚本设置。
  2. 在框架___中命名为导出类的文本字段。我放在那里我以前有2个
  3. 然后取消选中导出到第1帧仅适用于作为PRELOADER部分符号的符号
  4. 然后运行它工作的电影