I tried your solution, but its not working. Can you give me some example based on my code or a small code that you may already have.
Following is the code that I am using but having no success;
Code:
// Create new XML Object and set ignoreWhite true
book_xml = new XML();
book_xml.ignoreWhite = true;
// Setup load handler which just invokes another function
// which will do the parsing of our XML
book_xml.onLoad = function(sucess) {
if (sucess) {
processBook(book_xml);
}
};
// Load up the XML file into Flash
book_xml.load('book.xml');
// This is the function that will be called when
// our XML document is loaded succesfully
function processBook(xmlDoc_xml) {
// xmlDoc_xml is now a reference to the XML
// object where our information is stored
for (a in xmlDoc_xml.firstChild.childNodes) {
trace(a + ' ' + xmlDoc_xml.firstChild.childNodes[a]);
}
}
function processBook(xmlDoc_xml) {
// xmlDoc_xml is now a reference to the XML
// object where our information is stored
book = new Object();
book.authors = new Array();
var depth = 0;
var nextY = 30;
var nextX = 100;
//for (var n = 0; n<xmlDoc_xml.firstChild.childNodes.length; n++) {
//authorsNode=xmlDoc_xml.firstChild.childNodes[n];
//for(var d=0; d<authorsNode.firstChild.childNodes.length; d++){
for(var y=0; y<=2; y++){
for( var x=0; x<=2; x++){
_root.tempMC = attachMovie ("box", "box" + count, depth ++, {_y : (nextY) , _x : (nextX)} );
_root.tempMC.name_txt.text = trace(xmlDoc_xml.firstChild.childNodes[y].firstChild.childNodes);
_root.tempMC.img_holder.loadMovie(trace(authorsNode.firstChild.nextSibling.firstChild.nodeValue));
nextX += tempMC._width + 2;
count ++;
}
nextY += tempMC._height + 2;
}
//price_txt.text=authorsNode.firstChild.childNodes;
//frame_holder_mc.loadMovie(authorsNode.firstChild.nextSibling.firstChild.nodeValue);
//}
/*if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "Authors") {
//trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild.nodeValue);
book.authors.push(xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild);
price_txt.text=xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild;
frame_holder_mc.loadMovie(xmlDoc_xml.firstChild.firstChild.firstChild.nextSibling.firstChild.nodeValue);
}/* else if (xmlDoc_xml.firstChild.childNodes[n].nodeName == "ImageUrlSmall") {
//trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
book.authors.push(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
//price_txt.text=xmlDoc_xml.firstChild.childNodes[n].firstChild.firstChild.nodeValue;
frame_holder_mc.loadMovie(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
} *//*else {
//trace(xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue);
book[xmlDoc_xml.firstChild.childNodes[n].nodeName] = xmlDoc_xml.firstChild.childNodes[n].firstChild.nodeValue;
}*/
//}
}
It would be really nice if you can help me get this sorted or get me an example of how it should happen.
Thanks
Varsha
Bookmarks