Hi all, I’m new to Kirupa and XML on Flash. Could anyone help me?
I’m trying to make a gallery based on AS + XML. In the XML file I’ve years, and inside each year **expos **wich contains pictures. I’ve started from a Kirupa example, but I can’t make it work right now. ;(
The idea is to get a menu listing years at the left and when you pick a button a submenu appears with the expos for that year.
Something like:
The problem is the buttons for expos are already visible when the movie loads. I’m using an “onRelease” trying to call the Expo buttons, but they’re already open.
This is the XML
<vc>
<2000 type="year">
<expo type="expo">
<name>Expo 1</name>
<picture type="picture">
...
</picture>
<picture type="picture">
...
</picture>
</expo>
<expo type="expo">
<name>Expo 2</name>
...
</expo>
</2000>
<2001 type="year">
<expo type="expo">
<name>Expo 1 2001</name>
...
</expo>
</2001>
</vc>
And the AS:
function CreateMenu(menu_xml) {
var items = menu_xml.firstChild.childNodes;
for (var i = 0; i<items.length; i++) {
if (items*.attributes.type == "year") {
var year = items*.childNodes[0].parentNode;
var item_mc = menu_mc.attachMovie("menu_item", "item"+item_count, item_count);
item_count++;
item_mc.textButton_txt.text = year.nodeName;
item_mc.onRelease = CreateMenuExpos(year); // Here I try to create the Expos menu.
}
}
}
function CreateMenuExpos(menuExpos_xml) {
var expos = menuExpos_xml.childNodes;
for (var i = 0; i<expos.length; i++) {
var expo = expos*.childNodes[0].parentNode;
var expo_mc = menu_mc.attachMovie("menu_item", "expo"+item_count, item_count);
item_count++;
expo_mc. textButton_txt.text = expo.firstChild.firstChild;
}
}
var vc_xml = new XML();
vc_xml.ignoreWhite = true;
vc_xml.onLoad = function(success) {
if (success) {
CreateMenu(this);
} else {
trace("Error");
}
};
vc_xml.load("vc.xml");
Thanx in advance!