PDA

View Full Version : fade in image using actionscript


Aliya99
03-07-2007, 08:19 PM
hello.

i'm using the following code to bring external images into my movie. i would like them to fade in rather than just appear though. can anyone help me fix the code to make it work?

also, my % loader doesn't seem to work, any ideas?

imgbtn1.onRelease = function() {
infoField._visible = true;
startLoading("picture1.jpg");
};
imgbtn2.onRelease = function() {
infoField._visible = true;
startLoading("picture2.jpg");
};
imgbtn3.onRelease = function() {
infoField._visible = true;
startLoading("picture3.jpg");
};
function startLoading(whichImage) {
loadMovie(whichImage, "imageLoader");
_root.onEnterFrame = function() {
infoLoaded = imageLoader.getBytesLoaded();
infoTotal = imageLoader.getBytesTotal();
percentage = Math.floor(infoLoaded/infoTotal*100);
infoField.text = percentage+"%";
if (percentage>=100) {
delete this.onEnterFrame;
infoField._visible = false;
}
};
}

Aliya99
03-17-2007, 07:40 AM
no one?

FlashHed
03-20-2007, 08:44 AM
maybe this will help. create a movieclip with an instance name of test and paste this code in your actions layer.

speed = 1;
test._alpha = 0;
test.onEnterFrame = function() {
this._alpha += speed;
if (this._alpha>=100) {
this._alpha = 100;
}
};