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 fing thing to work. I have been threatening to punch my computer in the fing 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:

kirupaForum

It now looks like this:

import flash.display.;
import flash.events.

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)
xmlLoader.load(xmlString);

function onImagesXMLLoadComplete(ev:Event):void
{
trace(“Parsing XML…”);
try
{
//Convert the downloaded text into an XML
var myXML:XML = new XML(ev.target.data)
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));
}
trace(this.images_list);
this.display_first_image();
}
catch (e:TypeError)
{
//Could not convert the data, probably
//because is not formated correctly
trace(“Could not parse the XML”)
trace(e.message)
}

}

/////////////////////////////////////

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)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
*/
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]);
    loader.load(request);
    image.addChild(loader);
    trace(stage.stageHeight);
    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 = e.target.content;
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”?>
<images>
<pic>
<image>“ali.jpg”</image>
<caption>Kresge</caption>
</pic>
<pic>
<image>“jimi.jpg”</image>
<caption>Media Lab</caption>
</pic>
<pic>
<image>http://www.kirupa.com/developer/mx2004/pg/stata.jpg&lt;/image&gt;
<caption>Stata Center</caption>
</pic>
<pic>
<image>http://www.kirupa.com/developer/mx2004/pg/stata_lobby.jpg&lt;/image&gt;
<caption>Stata Lobby</caption>
</pic>
<pic>
<image>http://www.kirupa.com/developer/mx2004/pg/construction.jpg&lt;/image&gt;
<caption>Construction</caption>
</pic>
<pic>
<image>http://www.kirupa.com/developer/mx2004/pg/dome.jpg&lt;/image&gt;
<caption>The Dome</caption>
</pic>
<pic>
<image>http://www.kirupa.com/developer/mx2004/pg/structure.jpg&lt;/image&gt;
<caption>Structure</caption>
</pic>
</images>

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.

HELP!:wasted: