It's built into Flash 8:

import mx.xpath.XPathAPI;

function getXMLData() {
        var myXML:XML = new XML();
        myXML.ignoreWhite = true;
        myXML.onLoad = function(success:Boolean) {
                if (success) {
                        var groupAr:Array = 
XPathAPI.selectNodeList(this.firstChild,
"/data/grouplist/group");
                        var itemAr:Array = 
XPathAPI.selectNodeList(this.firstChild,
"/data/itemList/item");
                        for (var i:Number=0; i<groupAr.length; i++) {
                                trace(groupAr[i].firstChild.nodeValue);
                        }       
                        for (var i:Number=0; i<itemAr.length; i++) {
                                trace(itemAr[i].firstChild.nodeValue);
                        }       
                } else {
                        trace("XML loading failed !!!");
                }
        };
        myXML.load("myXML.xml");      
}

Tweakage may be necessary - I've had a couple glasses of wine.


Mike Britton
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to