Comment changer la taille et la fonte d'un texte ?

Résolu
nikitaetshiva Messages postés 19 Date d'inscription lundi 2 mars 2009 Statut Membre Dernière intervention 8 octobre 2009 - 11 mars 2009 à 05:08
nikitaetshiva Messages postés 19 Date d'inscription lundi 2 mars 2009 Statut Membre Dernière intervention 8 octobre 2009 - 11 mars 2009 à 15:09
Bonjour a tous,


Je debute, je n'ai jamais programme en AS et je me retrouve confrontee a des problemes de syntax dans la definition des variables ou dans le chargement..
J'affiche un texte dans un diaporama sous des photos et je n'arrive pas a intervenir sur les caracteristiques du texte.
Voila ma source :
(je laisse les differents essais que j'ai fait)

this.createEmptyMovieClip("diaporama", 0);
diaporama._y = 20;
diaporama._x = 10;


this.createEmptyMovieClip("diaporama2", 20);
diaporama2._y = 80;
diaporama2._x = 5;


var testaff = "India turlututu,Gogarna pouette,Goa India,Truc India,Bidule India,Machin India,Et encore India,Toujours India,Belle India,Magique India,Je ne sais plus India,Et encore India";
 infos = new Array();
    infos = testaff.split(","); 
 for (var i = 0; i<infos[i].length; i++) {
 }


for(var i = 0; i < nbr; i++) {


var mc = diaporama.createEmptyMovieClip("photo"+i, i);
mc._x = espace + (largeur + espace)*i;
mc.createEmptyMovieClip("conteneur", 0);
mc.conteneur.loadMovie("D:/essai-photoshop/photos/" + i + ".jpg");


var mc2 = diaporama2.createEmptyMovieClip("designation"+i, i);

mc2.createTextField("txtCommentaire",  i, mc._x+40, mc._y+40, 100, 100);


 mep_bloc = new TextFormat();
 mep_bloc.color = 0x234567;
 mep_bloc.font ="Action Jackson";
 mep_bloc.size = 20;
 mep_bloc.align = "center";
 mep_bloc.bold=true;
 mep_bloc.embedFonts = true;
 mc2.txtCommentaire.selectable = false;

 //mc2.txtCommentaire.setTextFormat(mep_bloc); CA MARCHE PAS
 

 //mc2.txtCommentaire.setTextFormat("arial", 30);

 //mc2.txtCommentaire.TextFormat = new TextFormat("Action Jackson", 30); CA MARCHE PAS
 //mc2.txtCommentaire.styleSheet = ".dmc";
 mc2.txtCommentaire.textHeight = 30;
 mc2.txtCommentaire.textWidth = 30;
 mc2.txtCommentaire.textColor = yellow;
 mc2.txtCommentaire.textSize = 30;
 
mc2.txtCommentaire.text = (infos[i]); // le texte s'affiche mais pas en fonction des parametres passes


photos[i] = mc.conteneur;
mc.nombre = i;
mc2.nombre = i;


mc.onRollOver = function() {
commentaires.text = "Photo n°" + this.nombre + " : " + infos[this.nombre];
 
 mep_bloc = new TextFormat();
 mep_bloc.color = 0x234567;
 mep_bloc.font ="arial";
 mep_bloc.size = 30;
 mep_bloc.align = "center";
 mep_bloc.bold=true;
 mep_bloc.embedFonts = true;
 mc2.txtCommentaire.selectable = false;
 //mc2.txtCommentaire.setTextFormat(mep_bloc);
 
 mc2.txtCommentaire.font = "arial";
 mc2.txtCommentaire.size = 30;
 mc2.txtCommentaire.textColor = "b63c50";
 
 mc2.txtCommentaire.text = infos[this.nombre];
 
 posLar = photos[this.nombre]._x;
 posHaut = photos[this.nombre]._y; 
 photos[this.nombre]._x = posLar - 10;
 photos[this.nombre]._y = posHaut - 10;
 photos[this.nombre]._xscale = 120;
 photos[this.nombre]._yscale = 120;
}
 
mc.onRollOut = function() {
 commentaires.text = "";
 photos[this.nombre]._x = posLar;
 photos[this.nombre]._y = posHaut;
 photos[this.nombre]._xscale = largeur - espace - 10;
 photos[this.nombre]._yscale = hauteur;
 }
}

Merci d'avance et bonne journee ;)

2 réponses

Orange73 Messages postés 1375 Date d'inscription dimanche 28 novembre 2004 Statut Membre Dernière intervention 2 août 2011
11 mars 2009 à 10:25
Hello,

Il faut appliquer ton setTextFormat APRES avoir appliquer ton texte ...

monChampTexte.text = "blabla";
monChampTexte.setTextFormat(myTextFormat);
3
nikitaetshiva Messages postés 19 Date d'inscription lundi 2 mars 2009 Statut Membre Dernière intervention 8 octobre 2009
11 mars 2009 à 15:09
Merci mille fois !!!!
C'est tout bete, vraiment MERCI !!!!
0
Rejoignez-nous