Creating menu from xml whit set interval

hi there,

lease can someone see what mistake i´m making.
In the attach are two files, i´m trying to create an menu from a xml file whit two attriburtes, name and link. But i want to each button appear whit 1 sec interval from the others until the menu.lenght is finishes

thanks

jagunco

Replace your code for this one:[AS]var i = 0;
function iniciar() {
miXML = new XML();
miXML.load(“links.xml”);
miXML.onLoad = function() {
menu = new Array();
menu = miXML.childNodes;
maxButtons = menu.length-1;
generar();
};
miXML.ignoreWhite = true;
}
function generar() {
if (i>=maxButtons) {
this.onEnterFrame = null;
} else {
i++;
newClips = newClip=button_mc.duplicateMovieClip(“newClip”+i, i);
this[“newClip”+i].titulo = menu*.attributes.titulo;
this[“newClip”+i].link = menu*.attributes.link;
newClip._x = 73;
newClip._y = i*(newClip._height+10);
}
}
function startTimer() {
start = getTimer()/1000;
}
function reset() {
iniciar();
startTimer();
}
_root.onEnterFrame = function() {
elapsedTime = Math.floor(getTimer()/1000-start);
(elapsedTime == 1) ? reset() : trace(elapsedTime);
};
startTimer();
stop();[/AS]

remember the post you helpe me because your transitions tutorial, i send i reply if you can give me clues to construct a transtion for level and not as the one from the tutorial from kirupa. I prefer working whit levels.

I tried, but I din´t understand what was mt mistake, i understand that i have to have a function that is triggered to preload the level, i tried to put inside the transition, but i can´t. can you help me

thsnks

Can you post the code you are using to preload into level?

hi there, now i´m rying to change this coe you osted for the menu xml for use set Interval, because i never worked whit getTimer()

For the preload whit level, I tried but because i could not understand the proper way,i erased it. Can you please give me clues

thanks

and the code whit setInterval is:
miXML = new XML();
miXML.load(“links.xml”);
miXML.onLoad = function() {
menu = new Array();
menu = miXML.childNodes;
maxButtons = menu.length-1;
};
miXML.ignoreWhite = true;
//BUTTONS
button_mc._visible = true;
//set how many duplicated clips
var maxClips = 10;
//variable to be used in adding clips
var i = 0;
//function to add clip
function addClip() {
//increment the i variably by 1
i++;
//duplicate target clip
newClip = button_mc.duplicateMovieClip(“newClip”+i, i);
_root[“newClip”+i].titulo = menu*.attributes.titulo;
//this[“newClip”+i].link = menu*.attributes.link;
newClip._x = 73;
newClip._y = i*(newClip._height+10);
//if the variable i is greater than or equal to the maxClips variable
if (i>=menu.length-1) {
//or i>=maxClips
//clear the interval and stop running this function
clearInterval(addClipsInterval);
}
}
//use setInterval to call the addClip function every 100 milliseconds
var addClipsInterval = setInterval(addClip, 100);
stop();

Here. And for the preloader, ill see what i can do.[AS]var i = 0;
function iniciar() {
var miXML = new XML();
miXML.load(“links.xml”);
miXML.onLoad = function() {
menu = new Array();
menu = miXML.childNodes;
maxButtons = menu.length-1;
generar();
};
miXML.ignoreWhite = true;
}
function generar() {
if (i>=maxButtons) {
clearInterval(gerar);
} else {
i++;
newClips = newClip=button_mc.duplicateMovieClip(“newClip”+i, i);
this[“newClip”+i].titulo = menu*.attributes.titulo;
this[“newClip”+i].link = menu*.attributes.link;
newClip._x = 73;
newClip._y = i*(newClip._height+10);
}
}
var gerar = setInterval(iniciar, 1000);
iniciar();
stop();[/AS]