Click vào Frame thứ nhất nhấn F9 để mở bảng ActionScript và chèn vào đoạn code sau:
beginFill(0, 100);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
endFill();
MovieClip.prototype.createSnow = function ()
{
this.clear();
this.lineStyle(2 + 3 * Math.random(), 16777215, 50 + 50 * Math.random());
this.x = 50 * (Math.random() - Math.random());
this.moveTo(this.x, 0);
this.lineTo(this.x, 5.000000E-001);
this.speed = 2 + 6 * Math.random();
this.spin = 7 * (Math.random() - Math.random());
this.wind = 3.000000E-002 * Math.random();
this._x = Stage.width * Math.random();
this._y = -20;
};
for (i = 0; i < 300; i++)
{
_root.createEmptyMovieClip("mc" + i, i).createSnow();
_root["mc" + i]._y = Stage.height * Math.random();
_root["mc" + i].onEnterFrame = function ()
{
this._y > Stage.height + 30 ? (this.createSnow()) : (this._y = this._y + this.speed);
this._x < -10 ? (this._x = Stage.width + 10) : (this._x = this._x % (Stage.width + 10));
this._rotation = this._rotation + this.spin;
this._x = this._x + this.wind * (_root._xmouse - Stage.width / 2);
};
}
Trong đó: for (i = 0; i < 300; i++) Số 300 là số bông tuyết sẽ có trong flash của bạn, nếu flash của bạn nhỏ có thể giảm đi, còn flash của bạn to thì có thể tăng số bông tuyết lên.
Như vậy là xong rồi. Thử nhấn Ctrl + Enter lên xem kết quả
0 nhận xét:
Đăng nhận xét