home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 108
/
jogo-disk-108.iso
/
Games
/
jeans_bags_makeover.swf
/
scripts
/
CSnow_.as
Wrap
Text File
|
2010-05-15
|
3KB
|
130 lines
function CSnow()
{
this.Init();
}
CSnow.prototype = new MovieClip();
CSnow.prototype.Init = function()
{
var _loc1_ = this;
if(_loc1_._width < 100)
{
_loc1_._width = 100;
}
if(_loc1_._height < 100)
{
_loc1_._height = 100;
}
_loc1_.m_nRight = _loc1_._width;
_loc1_.m_nBottom = _loc1_._height;
_loc1_.ins_Mask._width = _loc1_._width;
_loc1_.ins_Mask._height = _loc1_._height;
_loc1_._xscale = 100;
_loc1_._yscale = 100;
_loc1_.setMask(_loc1_.ins_Mask);
_loc1_.ConfirmValue();
_loc1_.CreateSnow();
};
CSnow.prototype.ConfirmValue = function()
{
var _loc1_ = this;
if(_loc1_.m_nSnowSpeed <= 0)
{
_loc1_.m_nSnowSpeed = 5;
}
if(_loc1_.m_nSnowSpeed > 100)
{
_loc1_.m_nSnowSpeed = 100;
}
if(_loc1_.m_nLeftWind > 10)
{
_loc1_.m_nLeftWind = 10;
}
if(_loc1_.m_nRightWind > 10)
{
_loc1_.m_nRightWind = 10;
}
};
CSnow.prototype.CreateSnow = function()
{
this.attachMovie(this.m_strSnowMovie,"Snow_Test",1);
if(this.Snow_Test == undefined)
{
this.m_strSnowMovie = "DefaultSnow";
}
this.Snow_Test.removeMovieClip();
i = 1;
while(i < this.m_nSnowMax)
{
this.attachMovie(this.m_strSnowMovie,"Snow" + i,i);
eval("this.Snow" + i)._x = -1;
eval("this.Snow" + i).onEnterFrame = this.SnowOnEnterFrame;
i++;
}
};
CSnow.prototype.SetSnow = function(snowMax)
{
if(this.m_nSnowMax > snowMax)
{
i = snowMax;
while(i < this.m_nSnowMax)
{
eval("this.Snow" + i).removeMovieClip();
i++;
}
}
else
{
i = this.m_nSnowMax;
while(i < snowMax)
{
this.attachMovie(this.m_strSnowMovie,"Snow" + i,i);
eval("this.Snow" + i)._x = -1;
eval("this.Snow" + i).onEnterFrame = this.SnowOnEnterFrame;
i++;
}
}
this.m_nSnowMax = snowMax;
};
CSnow.prototype.SetSpeed = function(Speed)
{
this.m_nSnowSpeed = Speed;
this.ConfirmValue();
};
CSnow.prototype.SetLeftWind = function(leftWind)
{
this.m_nLeftWind = leftWind;
this.ConfirmValue();
};
CSnow.prototype.SetRightWind = function(rightWind)
{
this.m_nRightWind = rightWind;
this.ConfirmValue();
};
CSnow.prototype.SnowOnEnterFrame = function()
{
var _loc1_ = this;
if(_loc1_._x <= 0 or _loc1_._x > _loc1_._parent.m_nRight or _loc1_._y > _loc1_._parent.m_nBottom)
{
_loc1_._parent.ResetSnowEntty(_loc1_);
}
else
{
_loc1_._x += _loc1_.t_nSpeedX;
_loc1_._y += _loc1_.t_nSpeedY;
}
};
CSnow.prototype.ResetSnowEntty = function(obj)
{
var _loc1_ = obj;
var _loc2_ = this;
var _loc3_ = random(120) - 10;
_loc1_._xscale = _loc3_;
_loc1_._yscale = _loc3_;
_loc1_._x = random(_loc2_.m_nRight) + 1;
_loc1_._y = random(_loc2_.m_nBottom) + 1;
_loc1_.t_nSpeedX = _loc2_.m_nRightWind + random(_loc2_.m_nRightWind) - (_loc2_.m_nLeftWind + random(_loc2_.m_nLeftWind));
_loc1_.t_nSpeedY = 2 + _loc2_.m_nSnowSpeed * _loc3_ * 0.01;
_loc1_.gotoAndPlay(1);
};
Object.registerClass("CSnow_",CSnow);