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 44 45 46 47
| ---Script---
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();
};
---fin de script--- |