# Xml image into movieclip

**URL:** <https://forum.kirupa.com/t/xml-image-into-movieclip/262022>\
**Category:** Uncategorized\
**Created:** [June 2, 2008, 6:10pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022 "2008-06-02T18:10:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![billy\_nugz](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@billy\_nugz](https://forum.kirupa.com/u/billy_nugz)\
**Post date:** [June 2, 2008, 6:10pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/1 "2008-06-02T18:10:01Z")

</div>

Hey guys I would like to know how to load a image into a movie clip via xml. I just need a list of images within the xml to load into different movieClips.

I have been able to use this in the past but now I need to tie it to xml and have no idea how.

```auto
var imageLoader:Loader;
 
function loadImage(url:String):void {

// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);

}
loadImage("pixelHouses.jpg");
 
function imageLoaded(e:Event):void {

// Load Image
imageArea.addChild(imageLoader);

}
 
function imageLoading(e:ProgressEvent):void {

// Use it to get current download progress
// Hint: You could tie the values to a preloader :)

}

```

Any help would be great, and any advice on how to tie this to a visible preloaded would be icing on the cake. Thanks for all and any help guys.

---

<div class="post-metadata">

**Author:** ![Anogar](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@Anogar](https://forum.kirupa.com/u/Anogar)\
**Post date:** [June 2, 2008, 6:32pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/2 "2008-06-02T18:32:36Z")

</div>

You’ll follow the same process, just load the XML first and extract the string that you want (i.e. “pixelHouses.jpg”) and then use that string to load the image. :thumb:

---

<div class="post-metadata">

**Author:** ![billy\_nugz](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@billy\_nugz](https://forum.kirupa.com/u/billy_nugz)\
**Post date:** [June 2, 2008, 6:50pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/3 "2008-06-02T18:50:08Z")

</div>

How would I go about doing that. I have tried a few things but cant seem to get it. I guess I should have stressed that Im ultra new to as3. I will continue to hack around withs some snippets but if you have any further info that would be great.

---

<div class="post-metadata">

**Author:** ![Alex\_Lexcuk](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alex\_Lexcuk](https://forum.kirupa.com/u/Alex_Lexcuk)\
**Post date:** [June 2, 2008, 8:44pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/4 "2008-06-02T20:44:36Z")

</div>

```auto

<Images>
 <Img>
  http://dnadillo.dn.ua/images/imag/magna_carta_131.JPG 
 </Img>

 <Img>
  http://dnadillo.dn.ua/images/imag/magna_carta_127.JPG
 </Img>

 <Img>
  http://dnadillo.dn.ua/images/imag/magna_33_1024.jpg
 </Img>

</Images>

```

[http://dnadillo.dn.ua/fla/XML/img\_xml.xml](http://dnadillo.dn.ua/fla/XML/img_xml.xml)

```auto

function ParseStory(bookInput:XML):void{ 
var my_string:String;
trace("XML Output"); 
trace("------------------------"); 
trace(bookInput.Img.text()[0]); 

var authorList:XMLList = bookInput.Img; 
  
 for each (var authorElement:XML in authorList) { 
  trace(authorElement); 
  url_array_string.push(authorElement);
 } 
trace(url_array_string.length);
 go=1;

} 

```

[http://dnadillo.dn.ua/fla/XML/img-xml-img.swf](http://dnadillo.dn.ua/fla/XML/img-xml-img.swf)  
[http://dnadillo.dn.ua/fla/XML/img-xml-img.zip](http://dnadillo.dn.ua/fla/XML/img-xml-img.zip)

---

<div class="post-metadata">

**Author:** ![billy\_nugz](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@billy\_nugz](https://forum.kirupa.com/u/billy_nugz)\
**Post date:** [June 3, 2008, 1:39am UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/5 "2008-06-03T01:39:33Z")

</div>

Hey Alex thanks for the post. However its a little advanced for me I noticed you have a for loop and stuff wich is cool but how would I go about dumbing it down? I have tryed but keep getting errors (still not the best with code in general)

Many thanks

---

<div class="post-metadata">

**Author:** ![billy\_nugz](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@billy\_nugz](https://forum.kirupa.com/u/billy_nugz)\
**Post date:** [June 3, 2008, 11:30pm UTC](https://forum.kirupa.com/t/xml-image-into-movieclip/262022/6 "2008-06-03T23:30:52Z")

</div>

ok guys im stuck, I just need the images to load into seperate clips on the stage. I cant even get them to trace. If somone could hold my hand on this one a bit more that would be real cool here are the files im working with the code is all off as I just got frustrated and I have been blindly trying to hack through this stuff.

Thanks again for any additional help
