Code làm pháo hoa totalAmount=0 amount=80; c=["0xff0000","0x00ff00","0x0000ff","0x99ffff","0xccffcc","0x66cc66"] function fire(r){ r=attachMovie("ray","ray"+i,i) r._rotation = 360*Math.random(); r._x=x r._y=y r._xscale =r._yscale = 20 + 80*Math.random(); myColor = new Color(r) myColor.setRGB(col); r.speed=15+10*Math.random(); r.mc.onEnterFrame=function(){ this._y-=this._parent.speed; this._alpha-=3; if (this._alpha<0){ delete this.onEnterFrame; removeMovieClip(this._parent); } } } setInterval(function(){ x = 100 + random(600) y = 100 + random(400); col=c[random(c.length)] for(i=totalAmount;i<totalAmount+amount;i++){ fire(); } totalAmount=(totalAmount+amount)%5000 },900);