Hi everyone,
I’m trying to apply a fade-in effect to a jpeg that is being dynamically loaded into a movieclip. The problem is, the fade works only when I do a refresh in page. The first time it shows no fade, just the image.
Here’s the code I’m using:
fita.loadMovie ("img1.jpg");
fita._alpha = 0
this.onEnterFrame = function() {
if (fita._alpha <= 100) {
fita._alpha += 10;
}
};
preloader.onEnterFrame = function () {
var loaded = fita.getBytesLoaded ();
var total = fita.getBytesTotal ();
var percent = Math.round((loaded/total)*100);
if (loaded != total) {
this._visible = true;
//this.l1.text = Math.round (loaded/1000) + " kb";
//this.t2.text = Math.round (total/1000) + "kb";
this.p3.text = percent + "%";
} else {
// fully loaded
this._visible = false;
}
};