# Cache, onLoad or mctween problem?

**URL:** <https://forum.kirupa.com/t/cache-onload-or-mctween-problem/192281>\
**Category:** Uncategorized\
**Created:** [June 27, 2006, 1:04pm UTC](https://forum.kirupa.com/t/cache-onload-or-mctween-problem/192281 "2006-06-27T13:04:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![involver](https://avatars.discourse-cdn.com/v4/letter/i/db5fbb/32.png) [@involver](https://forum.kirupa.com/u/involver)\
**Post date:** [June 27, 2006, 1:04pm UTC](https://forum.kirupa.com/t/cache-onload-or-mctween-problem/192281/1 "2006-06-27T13:04:09Z")

</div>

Hi everyone,

I’m making a gallery with the following order of events:

1. Click the button.
2. Load image.
3. When image is loaded, resize a box.
4. 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?

```auto
#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
