[thelist] Flash 5 and XML

Anthony Baratta Anthony at Baratta.com
Wed Nov 1 20:13:25 CST 2000


I posted this over at Macromedia's News Server and thought, "Qhat am I 
doing? I should be posting to evolt!!" ;-) {John, if you answer there - you 
don't have to answer here. }

We are investigating using Flash 5 as a catalog/shopping cart widget 
because of its XML functionality. e,g, send XML to the Flash 5 widget and 
change the content the user sees. It seems pretty cool. However, I'm having 
trouble parsing a simple XML document.

The "if (productXML.loaded)" always evaluates to false. Any clues would be 
appreciated.

XML Document....

<?xml version="1.0"?>
<products>
	<item name="one" price="3" quantity="3"/>
	<item name="two" price="6" quantity="4"/>
	<item name="three" price="9" quantity="5"/>
</products>

Flash 5 Code.....

// Load Products
productXML = new XML();
productXML.load("products.xml");
if (productXML.loaded) {
     productXML.firstChild;
     varTruth = 0;
     while (varTruth == 0) {
         products = products + productXML.attributes.name + chr(10);
         price = price + productXML.attributes.price + chr(10);
         quantity = quantity + productXML.attributes.quantity + chr(10);
         if (productXML.nextSibling == null) {
             varTruth = 1;
         }
     }
} else {
     products = "failed to load XML";
}



----
Anthony Baratta
President
Keyboard Jockeys





More information about the thelist mailing list