loadMovie from xml

Why doesn’t this work? :frowning:

AS


var picturesXML:XML = new XML();
picturesXML.ignoreWhite = true;
picturesXML.onLoad = function(ok) {
        if(ok) {
                var back:Array = picturesXML.firstChild.childNodes;
                for (var i = 0; i<back.length; i++) {
                        imgURL = back*.attributes.source;
      //trace(images*);
                        //trace(imgURL);
      this.loadMovie(imgURL);
                }
        } else {
                //error
        }
};
picturesXML.load("data.xml");

xml


<?xml version="1.0" encoding="iso-8859-1"?>
<background>
<back source="back1.jpg"/>
</background>

matt :slight_smile:

Replace this.loadMovie(imgURL);
with _root.loadMovie(imgURL);

In your case, this is referring to the XML. if you were to trace(this); it would return the XML. trace(_root); gives you _level0 which is what your looking for.

-Chris

Thank for your replay! :slight_smile:

I will try this next week, hehe so takes a while for me to test it

matt :slight_smile: