Hi everyone,
I'm trying to make a dynamic TreeMenu which has to load a second TreeMenu from one single organised XML file....
I was wundering if I can tell the TreeMenu only to load certain nodes or certain levels. Only the <node> parts of the XML file should fill the menu, everything beneath these nodes are only necessary for the next menu.
This is what I got so far:
PHP Code:
Blokhoogte = new Tween (blokje,"_height",Regular.easeInOut,10,160,16,false);
Blokhoogte.onMotionFinished = function() {
Blokbreedte = new Tween (blokje,"_width",Regular.easeInOut,10,210,16,false);
Blokbreedte.onMotionFinished = function() {
//Tree menu uit XML laden
shopXML = new XML();
shopXML.ignoreWhite = true;
shopXML.onLoad = function(success) {
if (success) {
tofillShop();
} else {
trace("The XML could not be loaded");
}
};
shopXML.load("content/content-test.xml");
}
};
function tofillShop() {
//Atach masters the component
attachMovie("Tree","shop",1);
shop.move(0,10);
shop.vScrollPolicy = "off";
//Style Tree
shop.rowHeight = 20;
//We filled the menu
shop.dataProvider = shopXML.firstChild.childNodes[4];
shop.setSize(210,150);
//event objects
shop.addEventListener("change",listChanged);
}
listChanged = new Object();
listChanged.change = function(evt_obj) {
var node = evt_obj.target.selectedNode;
//If it is a folder…
if (shop.getIsBranch(node)){
//If this is a branch, expand/collapse it.
if (shop.getIsOpen(node)){
shop.setIsOpen(node, false, true);
}
//We opened it if this closed
else{
shop.setIsOpen(node, true, true);
}
}
//If it is a bond…
else{
(String(node.attributes.functie))();
}
}
PHP Code:
function fill_jackets() {
//Atach masters the component
attachMovie("Tree","jackets",1);
jackets.move(230,5);
jackets.vScrollPolicy = "off";
//We filled the menu
jackets.dataProvider = shopXML.firstChild.childNodes[4].childNodes[0].childNodes[0];
//Auto height Tree
var TreeHeight = (shopXML.firstChild.childNodes[4].childNodes[0].childNodes[0].childNodes.length)*18;
jackets.setSize(105,TreeHeight);
//event objects
jackets.addEventListener("change",listChanged_J);
}
With this XML file:
PHP Code:
<?xml version="1.0" encoding="utf-8"?>
<content>
<collection>
<fall2008 name="Vision"><bodytekst></bodytekst></fall2008>
<summary name="Work"><bodytekst></bodytekst></summary>
</collection>
<bio></bio>
<stockists></stockists>
<contact></contact>
<shop>
<node label="COLLECTION">
<node label="jackets" functie="fill_jackets">
<item label="'AMELIA' COTTON">
</item>
<item label="'AMELIA' WOOL">
</item>
<item label="'CATHERINE'">
</item>
<item label="'JOSEPHINE'">
</item>
<item label="'LUCY' COTTON">
</item>
<item label="'LUCY' WOOL">
</item>
<item label="'SAM' LEATHER">
</item>
<item label="'VANESSA'">
</item>
</node>
<node label="hats" functie="fill_hats">
<item label="Exhibition RACM">
</item>
</node>
</node>
<node label="SIZING & PRODUCT INFORMATION" functie="fill_sizing">
</node>
<node label="TERMS & CONDITIONS OF SALE">
<node label="pricing & payment" ></node>
<node label="shipping & returns"></node>
</node>
<node label="ORDER FORM" functie="fill_orderform">
</node>
</shop>
<press></press>
<terms></terms>
</content>
My idea was to call a function that will load the next TreeMenu for 'jackets', but all the items in the jackets node are allready visible in the main TreeMenu.
How can I tell the TreeMenu to stop filling the content between the <node></node> labels?
So to be as clear as possible on this;
A TreeMenu appears, when clicking 'COLLECTION' only 'jackets' and 'hats' should appear. When clicking 'jackets' a function gets called. This function makes a new seperate TreeMenu which will load everything between the 'jackets' node.
Is this possible? And if so, how?
Any help is very much appreciated!