Hi All, I’ve read a few of the other threads on this subject but still had no luck. I’m loading jpgs via an xml file and the pics are all diffrent sizes. I’m trying to figure out how to center the image once loaded, but am running into brick wall after brick wall. Can anyone please help. This is not my code - i’m not at a point where i can write something like this myself - hence the confusion.
thanks in advance!
here’s the code:
this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());
//container_mc._x=(Stage.width - container_mc._width)/2;
//container_mc._y=(Stage.height - container_mc._height)/2;
//container_mc._x = 80;
//container_mc._y = 20;
content = container_mc;
images_xml = new XML();
images_xml.onLoad = startImageViewer;
images_xml.load("images.xml");
images_xml.ignoreWhite = true;
function startPreloading(content) {
preloader_mc._visible = true;
preloader_mc.bar._xscale = 0;
interval = setInterval(checkProgress,10, content);
}
function checkProgress(content) {
var contentSize = 0;
var contentLoaded = 0;
var loaded = 0;
contentSize = content.getBytesTotal();
contentLoaded = content.getBytesLoaded();
loaded = Math.ceil(contentLoaded / contentSize * 100);
preloader_mc.bar._xscale = loaded;
updateAfterEvent();
if (contentLoaded == contentSize && contentSize > 0) {
clearInterval(interval);
preloader_mc._visible = false;
}
}
function updateImage(newImageNode) {
startPreloading(content);
url = newImageNode.attributes.jpegURL;
description = newImageNode.firstChild.nodeValue;
description.htmlText;
container_mc.loadMovie(url);
}
function startImageViewer(success) {
rootNode = images_xml.firstChild;
totalImages = rootNode.childNodes.length;
firstImageNode = rootNode.firstChild;
currentImageNode = firstImageNode;
currentIndex = 1;
updateImage(firstImageNode);
}
next_btn.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
prev_btn.onRelease = function() {
previousImageNode = currentImageNode.previousSibling;
if (previousImageNode == null) {
break;
} else {
currentIndex--;
currentImageNode = previousImageNode;
updateImage(previousImageNode);
}
};