Bonjour a tous,
J'ai trouvé un tutorial qui m'expliquait comment créer un feu d'artifice. Jusque la tout va bien, je suis tout content, je le modifie a ma sauce, le paufine pour qu'il rentre la ou je voulais le faire rentrer mais il reste un probleme.
L'animation lance une fusée a chaque fois que l'utilisateur clique sur la souris. Je voudrais que ce soit automatique donc je change le onMouseDown par un onEnterFrame juste histoire de voir... et la, ben je suis pas déçu, des fusées qui partent dans tous les sens, sans fin, au point que l'animation finit vite par fonctionner au ralenti vu le nombre d'explosion a gérées.
Bref, je sèche sévère. J'ai tenté le setInterval, la boucle, le stop(); jumelé à un gotoandplay(); mais rien à faire, ça refuse de fonctionner.
Je voudrais qu'une fusée se lance automatiquement genre toutes les 1 ou 2 secondes...
Je vous mets le code de l'animation en esperant que vous pourrez m'aider :
_quality = "low";
ct = 10;
this.createEmptyMovieClip("clickSensor", 1);
clickSensor.onMouseDown = function() {
this._parent.attachMovie("arrow", "a"+ct, ct);
this._parent["a"+ct].onLoad = function() {
this.tx = (Math.random()*470);
this.ty = (Math.random()*100);
this._x = (Math.random()*470);
this._y = 200;
};
this._parent["a"+ct].onLoad();
this._parent["a"+ct].onEnterFrame = function() {
// move this arrow
this._x += 0.08*(this.tx-this._x);
this._y += 0.08*(this.ty-this._y);
if (Math.abs(this.tx-this._x)<1 && Math.abs(this.ty-this._y)<1) {
this.cv = newSparkColor();
this.a = Math.random()*35+15;
for (this.i=0; this.i<this.a; this.i++) {
this.t = "s"+ct;
this._parent.attachMovie("spark", this.t, _root.ct);
_root.ct++;
this._parent[this.t]._x = this._x;
this._parent[this.t]._y = this._y;
this._parent[this.t].col = this.cv;
this._parent[this.t].onLoad = function() {
this._alpha = Math.random()*50+50;
this._xscale = this._yscale=Math.random()*50+65;
this.c = new Color(this);
this.c.setRGB(this.col);
this.sp = (Math.random()*10)+10;
this.angle = (2*Math.PI)*Math.random();
this.xs = this.sp*Math.sin(this.angle);
this.ys = this.sp*-Math.cos(this.angle);
this.gr = 0.1;
this.grInc = Math.random()*0.08+0.06;
this.c = 1;
};
this._parent[this.t].onLoad();
this._parent[this.t].onEnterFrame = function() {
this._x += this.xs;
this._y += this.ys+this.gr;
this.xs = this.xs*0.8;
this.ys = this.ys*0.8;
this.gr += this.grInc;
this._alpha = 0.948*this._alpha;
this.c++;
if (this.c>60) {
this.removeMovieClip();
}
};
}
this.removeMovieClip();
}
};
_root.ct++;
};
function newSparkColor() {
r = Math.random()*140+115;
g = Math.random()*140+115;
b = Math.random()*140+115;
return (r << 16)+(g << 8)+b;
}
Merci d'avance a toux ceux qui pourront m'aider...
earth'