<products>
<list no="1">
<title>Bag One</title>
<font color="#663300">Bag One</font>
<txt>If you love baby pink and looking ultra feminine and sophisticated then our pink clutch bag is perfect and practical for holding all your evening essentials bl bl bllll</txt>
<image>thumbnails/img01ex.jpg</image>
<link>bag1.html</link>
<cost>£10.95</cost>
<description>Very nice bage with great ect</description>
<dimensions>W 120 mm x H 234 mm x D 102 mm</dimensions>
<availability>IN STOCK</availability>
<image2>photos/img01.jpg</image2>
<weight>Weight 500g</weight>
<AllSizes>
<shoesize shoesizeName="UK - Size 6" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 7" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 8" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 9" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 10" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 11" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 12" siteURL="http://www.macromedia.com"></shoesize>
</AllSizes>
</list>
</products>
I also found this but still had problems when I changed thisXML
Code:
function LoadCombo(success) {
if (success) {
//set variables
var BaseNode=thisXML.childNodes[0];
var ComboSizes = new Array();
var ComboURLs = new Array();
var ThisNode;
//get sites information
for (i=0; i < BaseNode.childNodes.length; i++) {
ThisNode = BaseNode.childNodes[i];
ComboSizes[i] = ThisNode.attributes["shoesizeName"];
ComboURLs[i] = ThisNode.attributes["shoesizeURL"];
//add to combo box
ChooseSize.addItem(ComboSizes[i],ComboURLs[i]);
ChooseSize.text="Select Size";
}
}
}
I have been working on this for 4 days with no luck can someone please help me out. Thanks
Last edited by shaunfreeman; 03-01-2008 at 11:16 AM.
That works but this reloads my xml, which I don't want as I want the sizes for that product. When I call for the combobox info I am already in that product node (Bag 1). By reloading the xml I lose focus on the product node.
When I add another product (Bag 2) to my xml the combobox just loads the sizes from (Bag 1)
Code:
<products>
<list no="1">
<title>Bag One</title>
<font color="#663300">Bag One</font>
<txt>If you love baby pink and looking ultra feminine and sophisticated then our pink clutch bag is perfect and practical for holding all your evening essentials bl bl bllll</txt>
<image>thumbnails/img01ex.jpg</image>
<link>bag1.html</link>
<cost>£10.95</cost>
<description>Very nice bage with great ect</description>
<dimensions>W 120 mm x H 234 mm x D 102 mm</dimensions>
<availability>IN STOCK</availability>
<image2>photos/img01.jpg</image2>
<weight>Weight 500g</weight>
<AllSizes>
<shoesize shoesizeName="UK - Size 6" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 7" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 8" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 9" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 10" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 11" siteURL="http://www.macromedia.com"></shoesize>
<shoesize shoesizeName="UK - Size 12" siteURL="http://www.macromedia.com"></shoesize>
</AllSizes>
</list>
<list no="2">
<title>Bag Two</title>
<font color="#663300">Bag Two</font>
<txt>Some Sort Of Destription Here</txt>
<image>thumbnails/img02.jpg</image>
<link>Bag2.html</link>
<cost>£10.95</cost>
<description>Black Leather With Chrome Chain</description>
<dimensions>W 190mm x H 300mm x D 182mm</dimensions>
<availability>OUT OF STOCK</availability>
<image2>photos/img01.jpg</image2>
<weight>Weight 800g</weight>
<AllSizes>
<ringsize ringsizeName="15.7mm - Size 5" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="16.5mm - Size 6" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="17.3mm - Size 7" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="18.2mm - Size 8" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="18.9mm - Size 9" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="19.8mm - Size 10" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="20.6mm - Size 11" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="21.3mm - Size 12" siteURL="http://www.macromedia.com"></ringsize>
<ringsize ringsizeName="22.2mm - Size 13" siteURL="http://www.macromedia.com"></ringsize>
</AllSizes>
</list>
</products>
Sorry if I was unclear, maybe a bit more info might help.
My logic tell me it need to be in the main searcher function I have.
The searcher function, well searches a product then displays results with a button within that result. That button sends the product info to the product page with where the combobox is. I have tried to put the code inside this function, but have had no luck.
PHP Code:
scene = 2;
_root.slidertwo.myScroller.setStyle("borderStyle", "none");
function mySearcher() {
//next line turns off button
_root.slidertwo.myScroller.spContentHolder.Searcher.productbtn._visible = true;
_root.slidertwo.status = "Searching...";
//This code removes possible existing movie duplicates so it can cleanly build a new list.
//It removes every movie except the main base Searcher movie.
for (mc in _root.slidertwo.myScroller.spContentHolder) {
tempName = ""+spContentHolder[mc];
if (tempName.charAt(tempName.length-1)<>"r") {
_root.slidertwo.myScroller.spContentHolder[mc].removeMovieClip();
}
}
//Create the search word array by sending everything to lowercase.
tempSearch = SearchField.toLowerCase();
if (tempSearch.charAt(tempSearch.length-1) == " ") {
do {
tempSearch = tempSearch.substring(0, tempSearch.length-1);
} while (tempSearch.charAt(tempSearch.length-1) == " ");
}
searchwords = tempSearch.split(" ");
//This code sets a limit of 3 words to search by. The else is the actual search Engine.
if (searchwords.length>3) {
_root.slidertwo.myScroller.spContentHolder.Searcher.searchtext = "Please limit your search to 3 words or less.";
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu = new Object();
_root.slidertwo.myScroller.spContentHolder.Searcher.searchtext = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.description = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.cost = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.description = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.loader_mc.unloadMovie("blank");
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuoff = "The Search Was Not Run";
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuon = "The Search Was Not Run";
_root.slidertwo.myScroller.spContentHolder.Searcher.menu = _root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuoff.toString();
_root.slidertwo.status = "Search Failed - Please Try Again";
//next line turns off button
_root.slidertwo.myScroller.spContentHolder.Searcher.productbtn._visible = false;
} else {
////Beginning of search engine.////
///////////////////////////////////
// //
// Variables: //
// Changed - a check to see if //
// anything was modified. //
// //
// matches - var used to pass //
// the number of hits //
// //
// counter - used as an iterator//
// to count actual hits //
// //
///////////////////////////////////
changed = "no";
matches = 0;
i = 0;
counter = 0;
while (i<xmlList.firstChild.childNodes.length+1) {
j = 0;
while (j<xmlList.firstChild.childNodes[i].childNodes.length+1) {
if (xmlList.firstChild.childNodes[i].childNodes[j].nodeName == "txt") {
//Change the search text for this node to lowercase and split it into a temporary Array
myTemp = _root.xmlList.firstChild.childNodes[i].childNodes[j].toString().toLowerCase();
myTemp = myTemp.substring(myTemp.indexOf(">")+1, myTemp.length-6);
tempArray = myTemp.split(" ");
//Loop through the temporary Array and through the search word Array to catch any hits
for (h=0; h<tempArray.length; h++) {
for (word in searchwords) {
if (tempArray[h].indexOf(searchwords[word]) != -1) {
tempArray[h] = tempArray[h].charAt(0).toUpperCase()+tempArray[h].substring(1, tempArray[h].length);
tempArray[h] = "<font color='#FF0000'>"+tempArray[h]+"</font>";
changed = "Yes";
matches = matches+1;
}
}
//After the last word is searched for in this tempArray, change any text not selected to a first-letter capital state
tempArray[h] = tempArray[h].charAt(0).toUpperCase()+tempArray[h].substring(1, tempArray[h].length);
}
//Duplicate the Searcher Movie and populate the variables based on the Changed variable
aStr = _root.xmlList.firstChild.childNodes[i].childNodes[j-4].toString();
trace("aStr = "+aStr);
bStr = _root.xmlList.firstChild.childNodes[i].childNodes[j-2].toString();
trace("bStr = "+bStr);
cStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+2].firstChild;
trace("cStr = "+cStr);
dStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+4].firstChild;
trace("dStr = "+dStr);
eStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+6].firstChild;
trace("eStr = "+eStr);
fStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+8].firstChild;
trace("fStr = "+fStr);
gStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+10].firstChild;
trace("gStr = "+gStr);
hStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+12].firstChild;
trace("hStr = "+hStr);
iStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+0].firstChild;
trace("iStr = "+iStr);
jStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+14].firstChild;
trace("jStr = "+jStr);
kStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+16].firstChild;
trace("kStr = "+kStr);
lStr = _root.xmlList.firstChild.childNodes[i].childNodes[j+18].firstChild;
trace("lStr = "+lStr);
if (changed == "Yes") {
counter = counter+1;
trace("counter = "+counter);
if (counter == 1) {
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu = new Object();
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuoff = aStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuon = bStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.menu = aStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.img = cStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.link = dStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.cost = eStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.description = fStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.dimensions = gStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.availability = hStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.txt = iStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.img2 = jStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.weight = kStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.sizes = lStr;
_root.slidertwo.myScroller.spContentHolder.Searcher.loader_mc.loadMovie(cStr);
_root.sliderfour.loader_mc.loadMovie(cStr);
_root.sliderthree.zooming.photo.loader2_mc.loadMovie(jStr);
_root.slidertwo.myScroller.spContentHolder.Searcher.searchtext = tempArray.join(" ");
//The two lines is to update the scroller
_root.slidertwo.myScroller.invalidate();
_root.slidertwo.myScroller.vPosition = myScroller.vScroller.minPos;
//
a = this.firstChild.childNodes;
for (b=a[0].firstChild; b != null; b=b.nextSibling) {
if (b.nodeName == "AllSizes") {
for (var n = 0; n != b.childNodes.length; n++) {
var1 = b.childNodes[n].attributes.shoesizeName;
var2 = b.childNodes[n].attributes.siteURL;
_root.sliderthree.ChooseSize.addItem({label:var1, data:var2});
}
// end for(n)
}
// end if
_root.sliderthree.ChooseSize.addItemAt(0, {label:"Select Size", data:0});
// combobox change event handler
var cb:Object = new Object();
cb.change = function(obj:Object) {
trace(obj.target.selectedItem.label);
trace(obj.target.selectedItem.data);
};
_root.sliderthree.ChooseSize.addEventListener("change", cb);
}
} else if (counter == 2) {
duplicateMovieClip(_root.slidertwo.myScroller.spContentHolder.Searcher, "Searcher"+counter, counter);
setProperty("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter, _x, _root.slidertwo.myScroller.spContentHolder.Searcher._x);
setProperty("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter, _y, _root.slidertwo.myScroller.spContentHolder.Searcher._y+_root.slidertwo.myScroller.spContentHolder.Searcher._height);
var tempVal = eval("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter);
tempVal.mymenu = new Object();
tempVal.mymenu.menuoff = aStr;
tempVal.mymenu.menuon = bStr;
tempVal.menu = aStr;
tempVal.img = cStr;
tempVal.link = dStr;
tempVal.cost = eStr;
tempVal.description = fStr;
tempVal.dimensions = gStr;
tempVal.availability = hStr;
tempVal.txt = iStr;
tempVal.img2 = jStr;
tempVal.weight = kStr;
tempVal.sizes = lStr;
tempVal.loader_mc.loadMovie(cStr);
tempVal.loader_mc2.loadMovie(jStr);
tempVal.searchtext = tempArray.join(" ");
//The two lines is to update the scroller
_root.slidertwo.myScroller.invalidate();
_root.slidertwo.myScroller.vPosition = myScroller.vScroller.minPos;
} else {
duplicateMovieClip(_root.slidertwo.myScroller.spContentHolder.Searcher, "Searcher"+counter, counter);
setProperty("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter, _x, _root.slidertwo.myScroller.spContentHolder.Searcher._x);
var drop = (counter-1)*getProperty("_root.slidertwo.myScroller.spContentHolder.Searcher", _height);
setProperty("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter, _y, _root.slidertwo.myScroller.spContentHolder.Searcher._y+drop);
var tempVal = eval("_root.slidertwo.myScroller.spContentHolder.Searcher"+counter);
tempVal.mymenu = new Object();
tempVal.mymenu.menuoff = aStr;
tempVal.mymenu.menuon = bStr;
tempVal.menu = aStr;
tempVal.img = cStr;
tempVal.link = dStr;
tempVal.cost = eStr;
tempVal.description = fStr;
tempVal.dimensions = gStr;
tempVal.availability = hStr;
tempVal.txt = iStr;
tempVal.img2 = jStr;
tempVal.weight = kStr;
tempVal.sizes = lStr;
tempVal.loader_mc.loadMovie(cStr);
tempVal.loader_mc2.loadMovie(jStr);
tempVal.searchtext = tempArray.join(" ");
}
//The two lines is to update the scroller
_root.slidertwo.myScroller.invalidate();
_root.slidertwo.myScroller.vPosition = myScroller.vScroller.minPos;
}
}
changed = "no";
j++;
}
i++;
}
//In case of no matches being found.
if (matches != 0) {
_root.slidertwo.status = "Returned "+counter;
//+matches; for word count
if (matches == 1) {
_root.slidertwo.status = _root.slidertwo.status+" Match";
} else {
_root.slidertwo.status = _root.slidertwo.status+" Matches";
}
} else {
//The two lines is to update the scroller
_root.slidertwo.myScroller.invalidate();
_root.slidertwo.myScroller.vPosition = myScroller.vScroller.minPos;
_root.slidertwo.myScroller.spContentHolder.Searcher.searchtext = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.description = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.cost = "";
_root.slidertwo.myScroller.spContentHolder.Searcher.description = "";
//next line turns off button
_root.slidertwo.myScroller.spContentHolder.Searcher.productbtn._visible = false;
_root.slidertwo.myScroller.spContentHolder.Searcher.loader_mc.unloadMovie("blank");
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu = new Object();
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuoff = "No Matches Found";
_root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuon = "No Matches Found";
_root.slidertwo.myScroller.spContentHolder.Searcher.menu = _root.slidertwo.myScroller.spContentHolder.Searcher.mymenu.menuoff.toString();
_root.slidertwo.status = "Returned No Matches";
}
}
}
//Load the list from the XML document
xmlList = new XML();
xmlList.load("xmltext/ListExample.xml");
xmlList.onLoad = mySearcher;
stop();
I have setup the node AllSizes to lStr and I am wondering if I can use this as the base node