Ciao Ragazzi ho questo script e sto impazzendo ......
carico da un file esterno la variabile [B]Titolo[B] e mi creo gli arrei
news = Titolo.split("|");
NWS = new Array();
// trace(news);
setButtons(0);
function setButtons(thisindex) {
for (i=0; i<news.length; i++) {
separatore = news[i].indexOf("§");
news_cod = news[i].substr(0, separatore);
NWS[i] = news_cod;
codice = NWS[i];
// trace ("news_cod=" + NWS[i]);
news_txt = news[i].substr(separatore+1);
_root.box_news.createEmptyMovieClip("button"+i, 100+i);
if (thisindex == i) {
_root.box_news["button"+i].lineStyle(1, 0xFFFFFF, 100);
_root.box_news["button"+i].beginFill(0xFFFFFF, 100);
} else {
_root.box_news["button"+i].lineStyle(1, 0xFFFFFF, 100);
_root.box_news["button"+i].beginFill(0xFFFFFF, 100);
}
_root.box_news["button"+i].moveTo(0, 0);
_root.box_news["button"+i].lineTo(10, 0);
_root.box_news["button"+i].lineTo(10, 10);
_root.box_news["button"+i].lineTo(0, 10);
_root.box_news["button"+i].endFill(0, 0);
_root.box_news["button"+i]._x = 0;
if (i == 0) {
H_tot = 0;
}
_root.box_news["button"+i]._y = H_tot;
_root.box_news["button"+i].tabIndex = i;
_root.box_news["button"+i].tabEnabled = true;
_root.box_news[i].useHandCursor = true;
// create labels for buttons
_root.box_news["button"+i].createTextField("myTextField"+i, 1, 0, 0, 200, 20);
_root.box_news["button"+i]["myTextField"+i].text = news_txt;
_root.box_news["button"+i]["myTextField"+i].multiline = true;
_root.box_news["button"+i]["myTextField"+i].wordWrap = true;
_root.box_news["button"+i]["myTextField"+i].autoSize = "left";
_root.box_news["button"+i]["myTextField"+i].border = false;
_root.box_news["button"+i]["myTextField"+i].variable = i;
_root.box_news["button"+i]["myTextField"+i].tabIndex = i;
_root.box_news["button"+i]["myTextField"+i].tabEnabled = true;
_root.box_news["button"+i]["myTextField"+i].trackAsMenu = true;
// format the buttons
myformat = new TextFormat();
myformat.type = "dynamic";
if (thisindex == i) {
myformat.color = 0xFF0000;
} else {
myformat.color = 0xCCCCCC;
}
myformat.bullet = false;
myformat.underline = false;
myformat.embedFonts = true;
myformat.selectable = false;
myformat.font = "Futura Md BT";
// myformat.font = "Verdana";
_root.box_news["button"+i]["myTextField"+i].setTextFormat(myformat);
// resize text area
h_testo = getProperty(_root.box_news["button"+i]["myTextField"+i], _height);
Y_testo = getProperty(_root.box_news["button"+i]["myTextField"+i], _y);
Y_bott = getProperty(_root.box_news["button"+i], _y);
X_testo = getProperty(_root.box_news["button"+i]["myTextField"+i], _x);
// trace("Y bottone = "+Y_bott);
H_tot = (Y_bott+h_testo)+3;
// trace("h_testo = " + h_testo);
//trace("H tot = "+H_tot);
trace("codice = "+codice);
// button function
_root.box_news["button"+i].onRelease = function(codice) {
// add function here
_global.newsCodice = codice;
//trace("codice nel bottone = "+ _global.newsCodice);
loadMovie("swf/news_dett.swf", "/barra");
setButtons(this.tabIndex);
};
}
}
vorrei che al click mi aprisse settando il parametro _global.news_codice con il valore di codice del bottone che ho cliccato.
Ma tracciando la variabile è vuota .......![]()
Qualcuno puo' aiutarmi per favore???

Rispondi quotando