home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 112
/
jogo-disk-112.iso
/
Games
/
jmonkey.swf
/
scripts
/
TFSnowEffectClass_symbol.as
Wrap
Text File
|
2010-07-14
|
2KB
|
63 lines
if(!§§pop())
{
TFSnowEffectClass = function()
{
this._x = 0;
this._y = 0;
this.preview_mc._visible = false;
this.xSpeedMin = 1;
this.xSpeedMax = 3;
this.ySpeed = 2;
this.turnTime = 5;
this.snow_array = new Array(100);
this.initSnowObjects();
this.onEnterFrame = this.letSnow_onef;
};
s = TFSnowEffectClass.prototype = new MovieClip();
s.initSnowObjects = function()
{
var mc;
var i = 1;
while(i <= this.snowTotal)
{
mc = this.snow_array[i] = this.attachMovie("TFSnowSymbol","snow" + i,i);
mc._x = random(Stage.width);
mc._y = - random(Stage.height * 3) + Stage.height;
mc.scale = (random(40) + 60) / 100;
mc.xspd = (random(2) - 0.5) * 2 * (random(this.xSpeedMax - this.xSpeedMin) + this.xSpeedMin) * mc.scale;
mc.yspd = this.ySpeed * mc.scale;
mc._xscale = mc.scale * 100;
mc._yscale = mc.scale * 100;
i++;
}
};
s.letSnow_onef = function()
{
var mc;
var total = 4;
var cos = new Array(total);
var a;
var i = 0;
while(i <= total)
{
a = (getTimer() + i * this.turnTime * 1000 / total) % (this.turnTime * 1000) / (this.turnTime * 1000) * 3.141592653589793 * 2;
cos[i] = Math.cos(a);
i++;
}
var i = 1;
while(i <= this.snowTotal)
{
mc = this.snow_array[i];
mc._x += cos[i % 5] * mc.xspd;
mc._y += mc.yspd;
if(mc._y >= Stage.height)
{
mc._x = random(Stage.width);
mc._y = - random(Stage.height);
}
i++;
}
};
Object.registerClass("TFSnowEffectClass_symbol",TFSnowEffectClass);
}