Propriété "embedFonts" sans classe "TextFormat"
Bonjour à toutes et tous,
Je ne développe pas en AS2 mais j'essaye plutôt de m'en sortir -lorsque j'en ai besoin- avec
"developpez.net" et quelques ouvrages.
En cherchant comment inclure une police non système dans une animation, je suis tombé sur cette
explication http://flash.developpez.com/faq/flas...ge=as#use_font qui m'a grandement aidé.
J'ai donc réussi à inclure une police dans l'anim' sur un script de David Tardiveau que voici
(les 2 lignes que j'ai rajouté sont en rouge et ont résolues mon soucis !)
Code:
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;
}
};
} |
Mais voilà sur ce deuxième script (du même David Tardiveau), j'ai beau tourner tout dans tous les sens,
Je n'arrive pas à incorporer une font dans l'animation finale.
Et oui là -pour le bidouilleur que je suis- pas de classe "TextFormat"..!
Voici le script :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
1. lachaine = new String("Je ne trouve pas comment faire..!");
2. i = 0;
3. function telex() {
4. i++;
5. zoneDaffichage = lachaine.substring(0, i)+"";
6. if (i>=lachaine.length) {
7. clearInterval(lancer);
8. zoneDaffichage = lachaine.substring(0, lachaine.length);
9. }
10. }
11. lancer = setInterval(telex, 100); |
Donc si celles et ceux qui auraient eu le courage de me lire ;) (et en espérant mettre bien expliqué) avaient une direction vers laquelle m'orienter...?
Dans l'attente de vous lire, merci.