I’ve read several threads on centering images in a movieclip. Basically I’m loading several images dynamically into a scrolling movieclip - portfolio style in a row. When you rollover the image the image enlarges.
My problem is that the images all load at their top left hand corner so that when you rollover and enlarge the image they also enlarge the image at the top left hand corner. I need them to load at the center so when they enlarge they also enlarge from the center. I have tried many different variations in trying to make this happen but I can’t seem to get it to work. I’ve manage to get the entire movieclip to center according to the first loaded image - but obviously that’s no good.
If anyone could help, I would sooooo appreciate it! I’m a bit of a newbie at AS - I hope I explained myself. Here’s my code…
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
thumbnails* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
thumbnails_fn(i);
}
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images1.xml");
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._xscale = target_mc._yscale = 75;
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
smoothImageLoad(thumbnails[k], target_mc);
target_mc.onRollOver = function() {
this.swapDepths(thumbnail_mc.getNextHighestDepth() );
this.onEnterFrame = function() {
this._xscale = this._yscale += 5;
if (this._xscale>101) {
delete this.onEnterFrame;
}
}
};
target_mc.onRollOut = function() {
this.onEnterFrame = function() {
this._xscale = this._yscale -= 5;
if (this._xscale<76) {
delete this.onEnterFrame;
}
}
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
:puzzled: