I am loading xml images, while also trying to center them onResize.
In this tutorial: http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm the images are all the same size, are being loaded into a static movieclip, and are aligned to the Top Left corner.
What I am trying to do is load different size images into a movie clip which stays centered on resize (i’m making a fullscreen flash site), while also loading each individual image centered within that clip (instead of the default top left).
Here is the code I am using for postioning the MC onResize:
mainInit();
function mainInit() {
// Set alignment and scale to allow onResize to work.
//Stage.align = "LT";
//Stage.scaleMode = "noScale";
// Create the title clip.
this.attachMovie("picture", "picture", 10);
// Keeps the title clip in place when the movie is resized.
picture.onResize = function() {
this._y = Stage.height-(picture._height/2);
this._x = Stage.width-(picture._width/2);
};
// Register titleClip to be notified when movie is resized.
Stage.addListener(picture);
// Set initial position of title clip.
this.picture.onResize();
}
I tested the following code (given to me by ‘The Canadian’ - thanks!) - within the xml onload function using that tutorial and it would not work with the first image, and seemed to only work properly 90% of the time:
picture._x = (Stage.width / 2) - (picture._width / 2);
picture._y = (Stage.height / 2) - (picture._height / 2);
…So, my question is does anyone know how to load center aligned variable size images, while also calling the movieclip to center onResize. I have tried everything I can think of and cannot get it working properly…