Bonjour a tous

suite a ce tutoriel " http://www.zoneflash.net/tutoriaux/t040.php "
je decide d'ameliorer mon animation en rajoutant 2 clip que j'appele "guide1" et "guide2" chaqun contenant un autre clip nommé "point"
et donc pour animé le tous g decidé de rajouter la boucle for

donc voici le code d'origine:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
vitesse = 5;
distanceMin = 10;
 
initialiser = function () {
clearInterval(intervalle);
this.createEmptyMovieClip("trajectoire", 0);
trajectoire._x = guide._x;
trajectoire._y = guide._y;
trajectoire.clear();
trajectoire.lineStyle(3, "0xFFFFFF", 100);
guide.gotoAndStop(1);
oldx = guide.point._x;
oldy = guide.point._y;
trajectoire.moveTo(oldx, oldy);
guide.point._visible = false;
intervalle = setInterval(nextImage, vitesse);
};
 
nextImage = function () {
guide.nextFrame();
if (guide._currentframe == guide._totalframes) {clearInterval(intervalle);
} else {
var newx = guide.point._x;
var newy = guide.point._y;
var dx = newx-oldx;
var dy = newy-oldy;
var d = Math.sqrt(dx*dx+dy*dy);
if (d>distanceMin) {
trajectoire.moveTo(newx, newy);
} else {
trajectoire.lineTo(newx, newy);
}
oldx = newx;
oldy = newy;
}
};
 
initialiser();
 
playAgain.onPress = function() {
initialiser();
};

et voici le mien apres avoir rajouter les boucle et fait quelque correction ,malhersemnt rien ne s'affiche (je pense que le pb pourrais venir du ciblage)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
vitesse = 5;
distanceMin = 10;
 
initialiser = function () {
	for (i=1; i<3; i++) {
clearInterval(intervalle);
this.createEmptyMovieClip("trajectoire", 0);
trajectoire._x = this["guide"+i]._x;
trajectoire._y = this["guide"+i]._y;
trajectoire.clear();
trajectoire.lineStyle(3, "0xFFFFFF", 100);
this["guide"+i].gotoAndStop(1);
oldx = this["guide"+i].point._x;
oldy = this["guide"+i].point._y;
trajectoire.moveTo(oldx, oldy);
this["guide"+i].point._visible = false;
intervalle = setInterval(nextImage, vitesse);
};
 
nextImage = function () {
guide.nextFrame();
if (this["guide"+i]._currentframe == this["guide"+i]._totalframes) {clearInterval(intervalle);
} else {
var newx = this["guide"+i].point._x;
var newy = this["guide"+i].point._y;
var dx = newx-oldx;
var dy = newy-oldy;
var d = Math.sqrt(dx*dx+dy*dy);
if (d>distanceMin) {
trajectoire.moveTo(newx, newy);
} else {
trajectoire.lineTo(newx, newy);
}
oldx = newx;
oldy = newy;
}
};
}
initialiser();
 
playAgain.onPress = function() {
initialiser();
};
je vous serai reconnaissent de l'aide que voux pourrez m'apporter
merci