# loadMovie from xml

**URL:** <https://forum.kirupa.com/t/loadmovie-from-xml/185169>\
**Category:** flash\
**Created:** [April 11, 2006, 2:41pm UTC](https://forum.kirupa.com/t/loadmovie-from-xml/185169 "2006-04-11T14:41:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattiej](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mattiej](https://forum.kirupa.com/u/mattiej)\
**Post date:** [April 11, 2006, 2:41pm UTC](https://forum.kirupa.com/t/loadmovie-from-xml/185169/1 "2006-04-11T14:41:29Z")

</div>

Why doesn’t this work? ☹

AS

```auto

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

```auto

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

```

matt 🙂

---

<div class="post-metadata">

**Author:** ![Jpao17](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@Jpao17](https://forum.kirupa.com/u/Jpao17)\
**Post date:** [April 11, 2006, 4:36pm UTC](https://forum.kirupa.com/t/loadmovie-from-xml/185169/2 "2006-04-11T16:36:11Z")

</div>

> [@mattiej](#):
>
> Why doesn’t this work? ☹
> 
> AS
> 
> ```auto
> 
> 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
> 
> ```html
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <background>
> <back source="back1.jpg"/>
> </background>
> 
> ```
> 
> matt 🙂

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

---

<div class="post-metadata">

**Author:** ![mattiej](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mattiej](https://forum.kirupa.com/u/mattiej)\
**Post date:** [April 11, 2006, 4:47pm UTC](https://forum.kirupa.com/t/loadmovie-from-xml/185169/3 "2006-04-11T16:47:30Z")

</div>

Thank for your replay! 🙂

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

matt 🙂
