Thanks Mike!

That looks like something I can tweak.
But, id do still have a question or two.

It seems it might go easier on me if I rdeifine the XML to use just child
nodes instead of attributes.  Does that make sense, or is there an easier
way to get at an attribute of your array then say:

var g_id:Number  = itemAr[i].firstChild.attribute.group.nodeValue;
var bgcolor:String = groupAr[g_id].firstChild.attribute.bgcolor.nodeValue;

I mean, I did a little searching on the web and found some XPath
documentation, thanks to Ramon's note, so is there something like.

var g_id:Number = XPathAPI.selectInteger(itemAr[i], "atribute::lang");
var bgcolor:String = XPathAPI.selectString(groupAr[g_id],
"attribute::bgcolor");

Hmm, even my examples, if they exists, seem verbose.  But if it works, then
I can get the stuff done I need too.

I guess the ideal would be for me to build some 'tweaked' object so that I
could use.

------------- ideal code ---------------
var data:Data = new Data("http://my.server.com/myapp/xmlfile"; + i_id +
".xml");

while (Data.items())  // iterator sets internal pointer to internal item
Array
{
 var bgcolor:String = Data.getBgColor(); // for example looks up the Group
by the current item's group attribute.
 ...
 // build display stuff
}
------------ /ideal code ---------------

If this is just a pipe dream, let me know.  I think something like my ideal
code example above would work great, because I won't be building the flash
for the application, and my flash designer is a little leary of
actionscripting.  And I knew conceptually that flash could read XML.  If I
can give her an object like that, then I know she can build what we need.

Thanks

Jeff


On 8/31/06, Mike Britton <[EMAIL PROTECTED]> wrote:

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

_______________________________________________
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