Cancella tutto lo script del primo layer, e sostituisci il secondo con:
codice:
function traguardi() {
cont = 0;
for (i=0; i<n.length; i++) {
nome = "oggetto"+i;
if (i>tasto) {
traguardo[i] = (i+n[tasto])*16+1;
for (a=cont; a<cont+n[i]; a++) {
traguardof[a] = traguardo[i];
}
cont = a;
} else if (i<tasto) {
traguardo[i] = inizio[i];
for (a=cont; a<cont+n[i]; a++) {
traguardof[a] = traguardo[i];
}
cont = a;
} else if (i == tasto) {
traguardo[i] = inizio[i];
for (a=cont; a<cont+n[i]; a++) {
if (a == cont) {
prima = a-1;
}
traguardof[a] = 16*(a-prima)+traguardo[i];
}
cont = a;
}
}
}
clip._visible = 0;
clip1._visible = 0;
function spegni() {
cont = 0;
for (i=0; i<n.length; i++) {
nome = "oggetto"+i;
_root[nome].gotoAndStop(1);
}
spegni1();
}
function spegni1() {
for (i=0; i<fields.length; i++) {
nome = "oggettonuovo"+i;
_root[nome].gotoAndStop(1);
}
}
function chiudi() {
cont = 0;
for (i=0; i<n.length; i++) {
nome = "oggetto"+i;
_root[nome].gotoAndStop(1);
traguardo[i] = inizio[i];
for (a=cont; a<cont+n[i]; a++) {
traguardof[a] = traguardo[i];
nome1 = "oggettonuovo"+a;
_root[nome1].gotoAndStop(1);
}
cont = a;
}
}
function init(){
cont = 0;
for (i=0; i<n.length; i++) {
nome = "oggetto"+i;
duplicateMovieClip(_root.clip, nome, i+100);
traguardo[i] = i*16+1;
inizio[i] = i*16+1;
_root[nome].tasto = i;
_root[nome]._y = i*16+1;
_root[nome].title = titoli[i];
for (a=cont; a<cont+n[i]; a++) {
nome1 = "oggettonuovo"+a;
duplicateMovieClip(_root.clip1, nome1, a);
traguardof[a] = i*16+1;
_root[nome1].field = a;
_root[nome1].link = links[a];
_root[nome1]._y = traguardo[i];
_root[nome1].title = fields[a];
}
cont = a;
}
}
mio_xml = new XML();
mio_xml.ignoreWhite = true;
mio_xml.path = this;
mio_xml.onLoad = function(success)
{
if(success){
this.path.titoli = [];
this.path.n = [];
this.path.fields = [];
var nodes = this.firstChild.childNodes;
for(var i = 0; i < nodes.length; i++){
this.path.titoli[i] = nodes[i].attributes.padre;
var chinods = nodes[i].childNodes;
this.path.n[i] = chinods.length;
for(var j = 0; j < chinods.length; j++){
this.path.fields.push(chinods[j].attributes.nomefiglio);
}
}
this.path.traguardo = new Array(this.path.n.length);
this.path.traguardof = new Array(this.path.fields.length);
this.path.inizio = new Array(this.path.n.length);
this.path.init();
} else {
trace("FILE XML ASSENTE");
}
};
mio_xml.load("menu.xml");