PDA

View Full Version : help with Reusable Preloader Using MovieClipLoader



leeharding
April 30th, 2005, 02:24 PM
Hello,

I have followed the tutorial "Reusable Preloader Using MovieClipLoader"
http://www.kirupa.com/developer/actionscript/moviecliploader.htm and found it extremely helpful, there is just one thing i would like to add to the code which i think should be easy, but i cannot work it out...

I would like to add a fade out as well as a fade in...

Any help with this would be grateful. thanks

Lee

ghjr
April 30th, 2005, 03:30 PM
Add this to your actionscript:



MovieClip.prototype.fadeOut = function(picture) {
this.onEnterFrame = function() {
if (this._alpha>0) {
this._alpha -= 10;
} else {
my_mc.loadClip(picture, "container");
delete this.onEnterFrame;
}
};
};


And then for each button (after number one) you change to this:



button2.onPress = function() {
container.fadeOut("movieClipLoader/picture2.jpg");
};


Substituting the "movieClipLoader/picture2.jpg" with the path to the next picture you want to load in, and the instance name of the button to which ever button you are on.


Cheers!

leeharding
April 30th, 2005, 04:45 PM
It works a treat, thank you very much ghjr....

ghjr
May 1st, 2005, 11:32 AM
Glad it worked... the fadeOut function works pratically the same as the fadeIn function, but instead of checking for alpha lower than 100 you check for alpha higher than 0 and just subtract 10 from it each cycle until it satifies that.


Cheers!