I am trying to load an external jpg into an empty movie clip, and at the moment its working, except i need the jpg to be centred each time, in other words the top left corner of the jpg is not supposed to be align with the top left corner of the movieclip.
BUT, I have worked out that all i need to do is before image is loaded move it UP by half its height and move it LEFT by half its height.
And now i don’t know where to put that peticular code.
Here is the code, i think I scabbed it from a tutorial ages ago.
MovieClip.prototype.fadeIn = function() {
this.onEnterFrame = function() {
if (this._alpha<100) {
this._alpha += 10;
} else {
delete this.onEnterFrame;
}
};
};
bar._visible = false;
border._visible = false;
var empty = this.createEmptyMovieClip("container", "100");
empty._x = 250;
empty._y = 175;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
container._alpha = 0;
bar._visible = true;
border._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = "% "+Math.round((lBytes/tBytes)*100);
};
preload.onLoadComplete = function(targetMC) {
container.fadeIn();
border._visible = false;
bar._visible = false;
dText._visible = false;
};
//buttons
_root.images.imagesMovie.button1.onPress = function() {
my_mc.loadClip("gallery1.jpg", "container");
};
_root.images.imagesMovie.button2.onPress = function() {
my_mc.loadClip("gallery2.jpg", "container");
};
// and so on