[Tweener] Loading images via xml

Philip Ames philco at thisworldover.com
Sat Oct 4 07:26:35 PDT 2008


Hi Gerry, thanks for your response. I'm using AS2 but didn't get much help
from the help section.

I'm using the following slice of code to try and pull in the XML on the
first frame of itemList, which is a child of the main stage...
---------------------
var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("images.xml");
myXML.onLoad = function(success) {
    if (success) {
    var myImage = myXML.firstChild.childNodes;
    for (i=0; i<myImage.length; i++) {
        var imageNumber = i+1;
        var imageName = myImage[i].attributes.title;
        var imageURL = myImage[i].firstChild.nodeValue;
        trace ("Image number is "+imageNumber+", is titled "+imageName+" and
is located in "+imageURL+".")
        }
    }
};
---------------------
And my XML is set up...
---------------------
<gallery>
<image title="image1">images/1.jpg</image>
<image title="image2">images/2.jpg</image>
<image title="image3">images/3.jpg</image>
<image title="image4">images/4.jpg</image>
<image title="image5">images/5.jpg</image>
</gallery>
---------------------

The trace returns everything it is supposed to, but the images do not load.
I've checked the paths and they are correct.

Any notions of what I'm doing wrong?

Thanks in advance




More information about the Tweener mailing list