Arrgh! Why can't I do this? Am I stupid?

Ok, don’t bother answering my “Am I stupid?” question - we already know where that’s going.

Hey thar, phellow phorum phreaks!

I am throughly frustrated, as you might have guessed by my subject. I’m trying to do something simple, but because of my lack of intelligence, or some other fault, I can’t make it work. Here’s my dilema:

I’ve got a picture imported into a flash item (of course) and I want it to behave as follows. Normally, it will be faded to 50% alpha, but when the cursor is moved over it, not clicking on it, just moving over it) the picuture is faded in all the way (100% alpha). It doesn’t need to be a link or anything else; that’s the complete task of the picture. This should be hard, should it?

I’ve only been using Flash for a little less than a month now, and have found this website, its tutorials, and especially the forum to be of invaluable help, so I thought I’d become a member of this esteemed collective and pose my query to the masses. I hope I can eventually become a worthwhile member here as well.

Thank you for your assistance.


This will do what you are looking for, just turn your picture into a movie clip and apply this code to it. I commented every line of the code to help you understand what is going on.

//when you move the mouse over the picture
on (rollOver){
	/* this speed variable makes it easy to adjust the speed
	it is the % the fade will change every frame */
	speed = 5;
	/* this line causes a function to be executed using
	onEnterFrame, this means the function will be executed
	at the speed of your framerate */
	this.onEnterFrame = function(){
		//check to see if the picture has faded in 100%
		if (this._alpha < 100){
			//if not increase it by whatever speed is
			this._alpha += speed;
		//if it has faded in 100%
		} else {
			//get rid of the function occuring onEnterFrame
			delete this.onEnterFrame;

//when you move the mouse off of the picture
on (rollOut){
	/* Same as above, execute the following function at
	the current frame rate */
	this.onEnterFrame = function(){
		//check if the fade is still above 50%
		if (this._alpha > 50){
			//if it is then decrease it by whatever speed is
			this._alpha -= speed;
		//if it is at or below 50%
		} else {
			//get rid of the function
			delete this.onEnterFrame;


That was exactly what I was looking for, of course! I’ll learn this all someday, I swear, but by that point, Flash Super MX 10.5 will be out I’ll have to catch up even more. Anyway, I appreciate the help.