Ciao a tutti .. spero potrete aiutarmi con questa cosa.
Ho queste due funzioni che mi creano un effetto neve molto carino
vorrei però comandare il tutto con un pulsante: mi spiego .. avrei bisogno di un pulsante che richiama la funzione init() facendo nevicare e poi in qualche modo la elimini.
In definitiva un pulsante "metti/togli effetto neve":
Che script devo mettere?
Grazie in anticipo a chi risponderà.![]()
questo è lo script:
init = function () {
width = 740;
// pixels dell'animazione solitamente corrisponde
//alle dimensioni dello stage
height = 550;
// pixels in altezza
max_snowsize = 10;
// pixels
snowflakes = 60;
// quantity
for (i=0; i<snowflakes; i++) {
t = attachMovie("snow", "snow"+i, i);
t._alpha = 20+Math.random()*60;
t._x = -(width/2)+Math.random()*(1.5*width);
t._y = -(height/2)+Math.random()*(1.5*height);
t._xscale = t._yscale=50+Math.random()*(max_snowsize*10);
t.k = 1+Math.random()*2;
t.wind = -1.5+Math.random()*(1.4*3);
t.onEnterFrame = mover;
}
};
mover = function() {
this._y += this.k;
this._x += this.wind;
if (this._y>height+10) {
this._y = -20;
}
if (this._x>width+20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
} else if (this._x<-20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
}
}
init();

Rispondi quotando
