动作脚本3.0来自2.0下降随机放置的对象和倒数计时器

时间:2015-11-23 06:23:23

标签: actionscript actionscript-2

在Flash动画中向我的学生讲授课程,寻求一些帮助。 不太熟悉代码,我基本上可以做这件事

我的动画上有四层。背景,雪,计时器和动作脚本。

我的雪层上有以下代码(上面有一个简单的白色椭圆形)

onClipEvent (load) {
    movieWidth=550;
    movieHeight=400;

    i=1+Math.random()*2;
    k = -Math.PI+Math.random()*Math.PI;

    this._xscale = this._yscale=50+Math.random()*100;
    this._alpha = 60+Math.random()*100;
    this._x = -10+Math.random()*movieWidth;
    this._y = -10+Math.random()*movieHeight;

}

onClipEvent (enterFrame){

    rad += (k/180)*Math.PI;
    this._x -= Math.cos(rad);
    this._y += i;
    if(this._y>=movieHeight){
        this._y = -5;
    }
    if((this._x>=movieWidth) || (this._x<=0)){
        this._x = -10+Math.random()*movieWidth;
        this._y = -5;
    }
}

这是我的动作脚本层

this.onEnterFrame = function()
{
    var today:Date = new Date();
    var currentYear = today.getFullYear();
    var currentTime = today.getTime();
    var targetDate:Date = new Date(currentYear, 11, 25);
    var targetTime = targetDate.getTime();
    var timeLeft = targetTime - currentTime();
    var sec = Math.floor(timeLeft/1000);
    var min = Math.floor(sec/60);
    var hours = Math.floor(min/60);
    var days = Math.floor(hours/24);

    sec = String(sec % 60);
    if(sec.length < 2){
        sec = "0" + sec;
    }

    min = String(min % 60);
    if(min.length < 2){
        min = "0" + min;
    }

    hours = String(hours % 24);
    if(hours.length < 2){
        hours = "0" + hours;
    }

    days = String(days)
    var counter:String = days + " Days\n" + hours + ":" + min + ":" + sec;
    time_txt.text = counter;

}

for (k=0; k<100; k++){
    duplicateMovieClip(this.snow, "snow"+k, k);
}

我知道这在以前的AS2中有效,但我无法让它工作。

当我使用旧版本

时,目前收到的语法错误并非如此

非常感谢任何帮助

由于

0 个答案:

没有答案