Hi everyone,
I’m making a gallery with the following order of events:
- Click the button.
- Load image.
- When image is loaded, resize a box.
- When box is resized fade in the alpha of the image.
I have accomplished this using the MC Tween library and a callback function to fade in the image after the box is resized. It works fine the first time but after that it won’t work. The picture always resets to 100% alpha once loaded. Any ideas how to fix it?
#include "mc_tween2.as"
//PRELOADER
//set up movie clip loader class with a variable
my_mcloader = new MovieClipLoader();
//make an object for the listener to talk to
preload = new Object();
//attach listener to object
my_mcloader.addListener(preload);
//
//
// when a file starts to load do func
preload.onLoadStart = function(targetMC) {
pText._visible = true;
picture._alpha=0
};
//when file is still in progress of loading do func
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
pText.text = "% "+Math.round((lBytes/tBytes)*100);
};
//when file is loaded do func
preload.onLoadInit = function(targetMC) {
pText._visible = false;
box.scaleTo(100,1,"linear",0,alpha)
};
// alpha fade func
alpha = function(targetMC){
picture._alpha=0
picture.alphaTo(100,3)
}
//buttons
button1.onPress = function() {
box.scaleTo(10)
my_mcloader.loadClip("snow.jpg", picture);
};
Any help would be seriously appreciated!
Thanks,
involver