Hey everyone,
This is my first post here at Kirupa and Im really hoping I can get some help.
Im writing an application that parses xml to display a menu system in Flash. The same loop that grabs the xml creates a new movie clip for each node(menuitem)
I need to set a delay between the duplicated movie clips so they appear one after another rather than all at the same time. Ive tried a few different things (interval and timer) but havent got it to work. I have no doubt that this is possible but I am fairly new to AS. Any help would be greatly appreciated.
Here is the code with a little comment where I want what I want.
var item_spacing = 60;
var item_count = 0;
var item_count_next = 0;
var newy = 0;
_global.itemNumber = "";
function CreateMenu(menu_xml){
_global.items = menu_xml.firstChild.firstChild.childNodes;
for (var i=0; i<items.length; i++) {
var item_mc = menu_mc.attachMovie("menu_item","item"+item_count, item_count);
item_mc._y = item_count * item_spacing;
if(item_count > 3){
item_mc._y = item_count_next * item_spacing;
item_mc._x = 350;
item_count_next++;
}
item_count++;
item_mc.txt.text = items*.attributes.type;
item_mc.main_btn.onRelease = function(){
item = this._parent._name.toString();
itemNumber = item.substr(4,2);
gotoAndPlay(10);
}
/*I NEED THIS LAST LINE IN THE FOR LOOP TO PAUSE FOR .5 SECONDS */
}
}
var dining = new XML();
dining.ignoreWhite = true;
dining.onLoad = function(success){
if (success) CreateMenu(this);
else trace("Error loading XML file");
}
dining.load("dining.xml");
stop();