shuga
April 21, 2003, 6:09pm
1
for (i=0; i<link.length; i++) {
_root.divisions.createEmptyMovieClip("mc"+i, i);
with (_root.divisions["mc"+i]) {
createTextField("label", 1003, 268, -155+(20*i), 90, 16);
with (label) {
background = true;
border = true;
borderColor = 0x003399;
backgroundColor = 0xF2F4FA;
type = "dynamic";
text = _root.divisions.link*;
selectable = false;
setTextFormat(myFormat);
}
}
that’s the code i have to create a menu dynamically using an array called link to get feed the text into the buttons.
how would i use setInterval in that for loop so that the buttons don’t appear all at once.
system
April 21, 2003, 6:33pm
2
just shooting in the dark here…
createMenu = function () {
i<link.length ? i++ : clearInterval(myInterval);
_root.divisions.createEmptyMovieClip("mc"+i, i);
with (_root.divisions["mc"+i]) {
createTextField("label", 1003, 268, -155+(20*i), 90, 16);
with (label) {
background = true;
border = true;
borderColor = 0x003399;
backgroundColor = 0xF2F4FA;
type = "dynamic";
text = _root.divisions.link*;
selectable = false;
setTextFormat(myFormat);
}
}
};
// this interval would create the menu at 24 fps
myInterval = setInterval(createMenu, 1000/24);
=)
system
April 21, 2003, 8:11pm
3
lol … when i put it in … the labels were created with value 1 as the first item
so the array containing the label names called link starts at value 0 obviously … and the boxes were created in the proper quantity but the first box had value 1 in it instead of value 0 and the last box was empty
other than that it works great
system
April 21, 2003, 8:15pm
4
so true… totally forgot about that.
try this one:
var i = 0;
createMenu = function () {
_root.divisions.createEmptyMovieClip("mc"+i, i);
with (_root.divisions["mc"+i]) {
createTextField("label", 1003, 268, -155+(20*i), 90, 16);
with (label) {
background = true;
border = true;
borderColor = 0x003399;
backgroundColor = 0xF2F4FA;
type = "dynamic";
text = _root.divisions.link*;
selectable = false;
setTextFormat(myFormat);
}
}
i<link.length ? i++ : clearInterval(myInterval);
};
myInterval = setInterval(createMenu, 1000/24);