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
|
var chaineAafficher = String("J'ai trouvé comment faire..!");
style1 = new TextFormat();
style1.font = "Zoidal BRK";
style1.size = 14;
style1.bold = true;
style1.color = 0x336600;
//
for (i=0; i<chaineAafficher.length; i++) {
_root.createEmptyMovieClip("lettre"+i, i);
_root["lettre"+i]._x = 100+(i*17);
_root["lettre"+i]._y = 100;
_root["lettre"+i].createTextField("caractere", 1, 0, 0, 80, 80);
_root["lettre"+i].caractere.text = chaineAafficher.substr(i, 1);
_root["lettre"+i].caractere.embedFonts = true;
_root["lettre"+i].caractere.setTextFormat(style1);
_root["lettre"+i].destinationX = _root["lettre"+i]._x;
_root["lettre"+i].destinationY = _root["lettre"+i]._y;
_root["lettre"+i]._x = random(1000)-200;
_root["lettre"+i]._y = random(830)-200;
_root["lettre"+i]._xscale = random(800)+50;
_root["lettre"+i]._yscale = random(600)+50;
_root["lettre"+i].onEnterFrame = function() {
distXrestante = this.destinationX-this._x;
distYrestante = this.destinationY-this._y;
echelleXrestante = 100-this._xscale;
echelleYrestante = 100-this._yscale;
this._x += (distXrestante)*0.2;
this._y += (distYrestante)*0.2;
this._xscale += (echelleXrestante)*0.1;
this._yscale += (echelleYrestante)*0.1;
bonneEchelleX = Math.abs(this._xscale) == 100;
bonneEchelleY = Math.abs(this._yscale) == 100;
if (Math.abs(distXrestante)<1 && Math.abs(distYrestante)<1 && bonneEchelleX && bonneEchelleY) {
this._x = this.destinationX;
this._y = this.destinationY;
this._xscale = 100;
this._yscale = 100;
delete this.onEnterFrame;
}
};
} |
Partager