ciao a tutti,
uso flash 8 pro,
ho un problema con la formattazione di un testo caricato dinamicamente.
ho 7 campi di testo del tipo
Titolo principale
titolo1
testo1
titolo2
testo2
titolo3
testo3
ora dovrei formattare questi campi attraverso un foglio di stile e per farlo uso il seguente codice (l'ho preso da questo forum):
codice:
System.useCodepage = true;
var myCss:TextField.StyleSheet = new TextField.StyleSheet();
myCss.onLoad = function(success)
{
if(success){
var data_var:LoadVars = new LoadVars();
//data_var.path = this;
data_var.onLoad = function(success)
{
if(success){
nomeScheda_txt.html=true;
nomeScheda_txt.text = this.nomescheda
titolo1_txt.html=true;
titolo1_txt.htmlText = "<p class='testoArancio'>" + this.titolo1 + "</p>";
titolo1_txt.html=true;
titolo2_txt.htmlText = "<p class='testoArancio'>" + this.titolo2 + "</p>";
titolo1_txt.html=true;
titolo3_txt.htmlText = "<p class='testoArancio'>" + this.titolo3 + "</p>";
testo1_txt.html=true;
testo1_txt.htmlText = "<p class='testoGrigio'>" + this.testo1 + "</p>";
testo2_txt.html=true;
testo2_txt.htmlText = "<p class='testoGrigio'>" + this.testo2 + "</p>";
testo3_txt.html=true;
testo3_txt.htmlText = "<p class='testoGrigio'>" + this.testo3 + "</p>";
nomeScheda_txt.styleSheet = myCss;
titolo1_txt.styleSheet = myCss;
titolo2_txt.styleSheet = myCss;
titolo3_txt.styleSheet = myCss;
testo1_txt.styleSheet = myCss;
testo2_txt.styleSheet = myCss;
testo3_txt.styleSheet = myCss;
} else {
trace("Errore nel caricamento del testo");
}
};
data_var.load("testi/falegnameria.txt");
} else {
trace("Errore nel caricamento del foglio di stile");
}
};
myCss.load("testi/styleContenuti.css");
Non riesco a spiegarmi perchè:
1 - nel titolo 2 e 3 compaiono i tag html mentre in titolo 1 no
2 - non viene generato nessun errore pero' il testo non viene formattato con lo stile del css caricato.
Grazie!