Problems regarding full browser photo gallery

Hey!

I would be very grateful if someone here on the forum could help me out with a couple of problems regarding xml flash gallery and as 2.0.

I have created a xml photo gallery from Kirupa (http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm)

I want to create a gallery where the images from the .xml fill the entire screen and scales proportionally. To achieve this I have followed this tutorial:

http://blog.fryewiles.com/design/07-14-2008/proportional-image-scaling-in-full-browser-flash

As long as I can center the content of the mc center to stage this works fine, but when I create an empty movie clip and try to load external content from the xml file to the mc (instance name = picture) the images does not behave as espexted. It looks as if the TL corner of the jpg images are aligned TL in relation to the MC. Also the image rotates 90degrees clockwise.

A final problem is that this test:

if ((Stage.height / Stage.width) <pictureHeight) (
picture._width = Stage.width;
picture._height = pictureHeight * picture._width;
) Else (
picture._height = Stage.height;
picture._width picture = Width * picture._height;
);

does not seem to work, so I have to pull the browser window before the image appears and scales.

Here is the action script:

function loadXML(loaded) {

if (loaded) {
	
	xmlNode = this.firstChild;
	image = [];
	description = [];
	total = xmlNode.childNodes.length;
	for (i=0; i&lt;total; i++) {
		
		image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
		description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
	}
	firstImage();

} else {
	
	content = "file not loaded!";
}

}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“images.xml”);
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);

previous_btn.onRelease = function() {

prevImage();

};
next_btn.onRelease = function() {

nextImage();

};

//center previous_btn horisontal
previous_btn._x = 0;
previous_btn._y = Stage.height / 2;

//Center next_btn horisontal and to right
next_btn._x = Stage.width;
next_btn._y = Stage.height / 2;

/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {

filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded == filesize) {
	
	preloader._visible = false;
            if (picture._width != 0) {
                this.onResize();

} else {
	
	preloader.preload_bar._xscale = 100*loaded/filesize;
	
	}
	if (picture._alpha&lt;100) {
		
		picture._alpha += 10;
		
	}
	
}

};

function nextImage() {

if (p&lt;(total-1)) {
	
	p++;
	if (loaded == filesize) {
		
		picture._alpha = 0;
		picture.loadMovie(image[p],1);
		desc_txt.text = description[p];
		picture_num();
		
	}
	
}

}
function prevImage() {

if (p&gt;0) {
	
	p--;
	picture._alpha = 0;
	picture.loadMovie(image[p],1);
	desc_txt.text = description[p];
	picture_num();
	
}

}

function firstImage() {

if (loaded == filesize) {
	
	picture._alpha = 0;
	picture.loadMovie(image[0],1);
	desc_txt.text = description[0];
	picture_num();

}

}

function picture_num() {

current_pos = p+1;
pos_txt.text = current_pos+" / "+total;

}

//////////////////////////////////
//FULL BROWSER

//set stage for FBF
Stage.align = “TL”;
Stage.scaleMode = “noScale”;

//define dynamic aspect ratios
pictureHeight = new Object ();
pictureHeight = picture._height / picture._width;

pictureWidth = new Object ();
pictureWidth = picture._width / picture._height;

//conditional statement to account for various initial browswer sizes and proportions

if ((Stage.height / Stage.width) < pictureHeight) {
picture._width = Stage.width;
picture._height = pictureHeight * picture._width;
} else {
picture._height = Stage.height;
picture._width = pictureWidth * picture._height;
};

//center picture on stage
picture._x = Stage.width / 2;
picture._y = Stage.height / 2;

// create listener
sizeListener = new Object();

// make listener change picture size and center picture on browser resize
sizeListener.onResize = function() {

if ((Stage.height / Stage.width) &lt; pictureHeight) {

	picture._width = Stage.width;
	picture._height = pictureHeight * picture._width;
} else {
	picture._height = Stage.height;
	picture._width = pictureWidth * picture._height;
};	


picture._x = Stage.width / 2;
picture._y = Stage.height / 2;

menuback._width = Stage.width;

}

//add listener to stage
Stage.addListener(sizeListener);

Thank you very much in advance
Armand