Xml image into movieclip

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.

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.

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:

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.


<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


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.zip

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

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