# Optimizing Alpha Crossfade Performance for Large Images

**URL:** <https://forum.kirupa.com/t/optimizing-alpha-crossfade-performance-for-large-images/243859>\
**Category:** flash\
**Created:** [November 11, 2007, 11:12pm UTC](https://forum.kirupa.com/t/optimizing-alpha-crossfade-performance-for-large-images/243859 "2007-11-11T23:12:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBN](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbn/32/2239_2.png) [@JBN](https://forum.kirupa.com/u/JBN)\
**Post date:** [November 11, 2007, 11:12pm UTC](https://forum.kirupa.com/t/optimizing-alpha-crossfade-performance-for-large-images/243859/1 "2007-11-11T23:12:44Z")

</div>

Hey, thanks for your help everyone, i just shrunk the images and made them psudo follow the mouse, seems to be smoother and more fun for people. I can’t wait till computers can do full-screen image rendering, boy will that be fun!

original post, link is dead now:

Okay, I know this may be asking the impossible, my images are big, there are a lot of them, and my computer is about 3 years old, but I would like to see if I can’t get this new project I am working on crossfade more smoothly.

Test: [http://www.jbnight.com/jasontest/working.html](http://www.jbnight.com/jasontest/working.html)  
Specs: Flash 8, AS 2.0, 800x600px, 25fps  
Images: Average 45k, sRGB, 800wide, on timeline in separate layers  
Hits: MC’s are 150x150 in a grid, nn separate layers on timeline

```auto
MovieClip.prototype.fadeIn = function() {
		if (this._alpha<100) {
			this._alpha +=4;
		} else {
			delete this.onEnterFrame
	}
}
	
MovieClip.prototype.fadeOut = function() {
		if (this._alpha>0) {
			this._alpha -=4;
		} else {
			delete this.onEnterFrame
	}
}

Image01.hitArea = Hit01;
Hit01._visible = false;
Image01._alpha = 0;
Image01.useHandCursor = false;
Image01.onRollOver = function () {
	Image01.onEnterFrame = fadeIn
	}
Image01.onRollOut = function () {
	Image01.onEnterFrame = fadeOut
	}

```

I just duplicated the Image AS and replaced the numbers, I will eventually have 24.

This is the first time I’ve hand-written all my code instead of copy/paste, so I’m proud I at least have it working for once! It certainly isn’t pretty, and I know I could be using this all dynamically, but I really just need it to be fast, I won’t be switching out images too much.

My current site, [www.jbnight.com](http://www.jbnight.com) , uses a similar method to crossfade, and it works very smoothly, but the images are smaller, is that the only difference in the speed, or am I just completely missing something?

Thanks for your help! Someday I’ll get this AS stuff down better.
