Ciao a tutti!
Sono riuscito a creare una galleria di immagini molto semplice che vengono caricate da un file XML.
Il codice è corretto e funzionante:

var xmlRequest:URLRequest = new URLRequest("xmlData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML; //conterrà XML data

var imageLoader:Loader;

//Used to get image details from the XML file for the Loader
var rawImage:String;
var rawH:String;
var rawW:String;

//Actual image
var imgNum:Number = 0;

//Deelay to Load from an image to another
var checkSec:Timer = new Timer(100);

//number of images that will be present
var numberOfChildren:Number;


//master_mc is the desktop that we use as background
master_mc.addEventListener(MouseEvent.CLICK, nextImgF);
master_mc.buttonMode = true; //show the hand instead of arrow


//When mouse click, increase imgNum to update the actual image
function nextImgF(event:MouseEvent):void{
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgNum++;
}

//Manage the image Loading and the restart from the beginning of the gallery
function checkerF(event:TimerEvent):void{
// - If it's the first image, then call packagedF to Load images from the XML file
// - else, if we aren't at the end of the images (or charging not the first image)
// unload the previous image (unload) and call packageF to load a new image
// - else if we've finished all the images, then start from the first image.
if(imgNum == 0){
packagedF();
} else if(imgNum < numberOfChildren){
imageLoader.unload();
packagedF();
} else{
imageLoader.unload();
imgNum = 0;
packagedF();
}
}//checkerF



//When the movie loading is completed, add file from XML file to imgData
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);

function xmlLoadedF(event:Event):void{
checkSec.start();
checkSec.addEventListener(TimerEvent.TIMER, checkerF);
imgData = new XML(event.target.data); //content of the XML file
}
// - - - -

//Get the image (A SINGLE IMAGE! THE # imgNum!) from the XML file
//and send to master_mc
function packagedF():void{
checkSec.removeEventListener(TimerEvent.TIMER, checkerF);
rawImage = imgData.image[imgNum].imgUrl; //<imgURL></imgURL> è un elemento del file XML
numberOfChildren = imgData.*.length(); //number of images

//get <imgH> and <imgW>
rawH = imgData.image[imgNum].imgH;
rawW = imgData.image[imgNum].imgW;

//create a Loader to load the image, added to the master_mc as a child
imageLoader = new Loader();
imageLoader.load(new URLRequest(rawImage));
master_mc.addChild(imageLoader);

//centrare l'immagine
imageLoader.x = (stage.stageWidth - Number(rawW))/2;
imageLoader.y = (stage.stageHeight - Number(rawH))/2;
}//packagedF

Ora il mio prossimo goal è quello di creare una scrivania di immagini drag & drop, ovvero caricare da un file XML le immagini e disporle in una scrivania (l'area dello stage che precedentemente era "master_mc").

Il codice che ho scritto è il seguente:

var rawImage:String;
var imageLoader:Loader;


//Deelay to Load from an image to another
var checkSec:Timer = new Timer(100);

var xmlRequest:URLRequest = new URLRequest("xmlData.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;

xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);

function xmlLoadedF(event:Event):void{
checkSec.start();
checkSec.addEventListener(TimerEvent.TIMER, loadImages);
imgData = new XML(event.target.data); //legge tutto il file XML
}


var numberOfChildren:Number = imgData.*.length(); //number of images


function loadImages(evt:Event):void{
for(var imgNum:Number = 0; imgNum < numberOfChildren; imgNum++){
rawImage = imgData.image[imgNum].imgUrl; //<imgURL></imgURL> è un elemento del file XML

//create a Loader to load the image, added to the master_mc as a child
imageLoader = new Loader();
imageLoader.load(new URLRequest(rawImage));
master_mc.addChild(imageLoader);

//centrare l'immagine
imageLoader.x = ((imgNum - 1)*200);
imageLoader.y = 20;
trace("Img " + imgNum + ": x-" + imageLoader.x + " y-" + imageLoader.y);
trace(".");

imageLoader.addEventListener(MouseEvent.MOUSE_DOWN , mouseDownHandler);
imageLoader.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
}//loadImages



// Define a mouse down handler (user is dragging)
function mouseDownHandler(evt:MouseEvent):void {
var object = evt.target;
// we should limit dragging to the area inside the canvas
object.startDrag();
}

function mouseUpHandler(evt:MouseEvent):void {
var obj = evt.target;
obj.stopDrag();
}
ma mi viene dato un errore:
TypeError: Error #1009: Impossibile accedere a una proprietà o a un metodo di un riferimento oggetto null.
at draggableGallery_fla::MainTimeline/frame1()

Non riesco a capire quale oggetto sia null!!
Potete aiutarmi a sistemare questo codice?

Grazie!!