# Creating menu from xml whit set interval

**URL:** <https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703>\
**Category:** flash\
**Created:** [August 5, 2003, 7:51pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703 "2003-08-05T19:51:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagunco](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jagunco](https://forum.kirupa.com/u/jagunco)\
**Post date:** [August 5, 2003, 7:51pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/1 "2003-08-05T19:51:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2003, 5:15pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/2 "2003-08-06T17:15:49Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2003, 5:53pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/3 "2003-08-06T17:53:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2003, 5:55pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/4 "2003-08-06T17:55:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 10:52am UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/5 "2003-08-07T10:52:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:37pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/6 "2003-08-07T12:37:05Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 2:18pm UTC](https://forum.kirupa.com/t/creating-menu-from-xml-whit-set-interval/27703/7 "2003-08-07T14:18:09Z")

</div>

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]
