This XML loader stuff is KILLING ME!

seriously, I may actually die from trying to get this to work.
I have been copying and pasting code for two days (again), and I can’t get this f***ing thing to work. I have been threatening to punch my computer in the f***ing face. I know it’s not his fault, poor thing.

There are tutorials, threads, posts, discussions, etc, etc, about using XML to load images into a gallery. I cant get it. My most recent dead end started here:

It now looks like this:

import flash.display.;

import flash.display.Loader;
import flash.display.LoaderInfo;

var images_list:Array = new Array();
var images_count:int = 0;
var loaded:int = 0;
var loaded_filesize:int = 0;

//Create the loader, set dataFormat to text
//and listen when data is loaded
var xmlString:URLRequest = new URLRequest(“images.xml”);
var xmlLoader:URLLoader = new URLLoader()
xmlLoader.dataFormat = URLLoaderDataFormat.TEXT
xmlLoader.addEventListener(Event.COMPLETE, onImagesXMLLoadComplete)

function onImagesXMLLoadComplete(ev:Event):void
trace(“Parsing XML…”);
//Convert the downloaded text into an XML
var myXML:XML = new XML(
var list:XMLList = myXML…image;
this.images_count = list.length();
for(var i=0; i<this.images_count; i++)
this.images_list.push(new Array(list*.filename, list*.caption));
catch (e:TypeError)
//Could not convert the data, probably
//because is not formated correctly
trace(“Could not parse the XML”)



prev_btn.addEventListener(MouseEvent.CLICK, onPrevButtonClickEvent);
next_btn.addEventListener(MouseEvent.CLICK, onNextButtonClickEvent);

function onPrevButtonClickEvent(e:Event):void
trace(“previous btn clicked”);

function onNextButtonClickEvent(e:Event):void
/* if (p<(total-1)) {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
trace(“next btn clicked”);

this.addEventListener(Event.ENTER_FRAME, onEnterFrameEvent);

function onEnterFrameEvent(e:Event):void
/* this.filesize = Stage.loaderInfo.bytesTotal();
this.loaded_filesize = Stage.loaderInfo.bytesLoaded();
preloader._visible = true;
if (this.loaded_filesize != this.filesize) {
preloader.preload_bar._xscale = (this.loaded_filesize / this.filesize) * 100;
} else {
preloader._visible = false;
if (image._alpha < 100) {
image._alpha += 10;

function display_first_image():void
trace(“loading …” + this.images_list[0][0]);

//if (this.loaded_filesize == this.filesize)
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderCompleteEvent); 
    //loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInitEvent);
    //loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    var request:URLRequest = new URLRequest(this.images_list[0][0]);
    image.x = 0;
    image.y = 0;


function onLoaderCompleteEvent(e:Event):void
trace(“Loading completed…Resizing…”);
// create a reference to the payload for easy coding…
var thatpic:Bitmap =;
image.scaleY = image.scaleX;
// either…
image.width = 300;
//image.height = 300;
// or this will work…
//thatpic.width = 300;
//thatpic.height = 300;

my XML, so far looks like this, which I demonstrate because maybe that’s the problem, ali.jpg and jimi.jpg are in the same folder as my broken swf and fla:

<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?>
<caption>Media Lab</caption>
<caption>Stata Center</caption>
<caption>Stata Lobby</caption>
<caption>The Dome</caption>

By the way, I have tried with and without quotes for the jpgs, but they only worked as well as the rest of the crap I’ve been doing for two days.

I want to be able to load images, hopefully one day soon with a preloader, which will probably cost me another 3-5 days to work out, into an image gallery when the user clicks on thumbnails.

The tutorial for XML Photo Gallery is EXCELLENT for MX, but for AS3, I’m definitely not smart enough to convert it all.