Been a while,
I have some thumbnails, when clicked on, the larger image loads which fades in and is centered. My problem lies with the first image which I want to automatically load when the swf is called. At the moment, it loads the image from the top left corner of the MovieClip, it fades it but [COLOR=Red]no border and I can’t get it to center[/COLOR]. I want to call the function which fades in and centers the opening image onLoad. I have attached the fla which has been edited so it only includes the problem. I hope someone can help using the same or a similar function to mine as it will be applied to each thumbnail.
This appears at the top of my AS code:
onLoad = function() {
//onload, load the first image into the MC
ImageContainer._alpha = 0;
ImageContainer.loadMovie("images/image0.jpg");
//This function centers, borders and fades the image in
preload();
}
This is the preload function(s), please remember this same function works fine when a thumbnail is clicked on it!
function preload() {
this.onEnterFrame = function() {
var l = ImageContainer.getBytesLoaded();
var t = ImageContainer.getBytesTotal();
var percent = Math.round((l/t)*100);
percent -= (percent-((l/t)*100))*.25;
per = int(percent);
if (l<t){
percentage = per+" percent";
bytes = "loading ("+l+"/"+t+")";
}
if (t>0 && l>=t) {
percentage = "";
bytes = "";
ImageContainer._x -= ImageContainer._width/2;
ImageContainer._y -= ImageContainer._height/2;
ImageContainer.createEmptyMovieClip("border",7453);
ImageContainer.border.lineStyle(0,0x000000,100);
ImageContainer.border.lineTo(ImageContainer._width,0);
ImageContainer.border.lineTo(ImageContainer._width,ImageContainer._height);
ImageContainer.border.lineTo(0,ImageContainer._height);
ImageContainer.border.lineTo(0,0);
ImageContainer.bordered = true;
//calls fadeIn program
this.onEnterFrame = FadeImage;
}
}
};
function FadeImage() {
if (ImageContainer._alpha<100) {
trace("fade");
//changing digit will change speed
ImageContainer._alpha += 10;
} else {
this.onEnterFrame = null;
}
};
Thanks!