[FMX] simple doubt in actionscript

Hi folks…
I have a movieclip which i want to gradually come into focus(vary the _alpha value) on mouseover and fade away on mouseout.
I am new to actionscript.
can anyone help.
this is my code assigned for the movieclip…
but nothing seems to happen on mouseover.

on(rollover) {
if(this._alpha < 75) {
this._alpha = 75;
}
else {
this._alpha = 0;
}
}
on(rollOut) {
this._alpha=0;
}

pls help me out…
thanks

Ok, to make this work you need to apply the button code to a movie clip. Yes, in MX this is luckily possible (I love this feature).

Ok, now you want to apply this code to the movie clip…

on (rollOver) {
	this.onEnterFrame = function() {
		this._alpha -= 5;
		if (this._alpha<=0) {
			this._alpha = 0;
		}
	};
}
on (rollOut) {
	this.onEnterFrame = function() {
		this._alpha += 5;
		if (this._alpha>=100) {
			this._alpha = 100;
		}
	};
}

That tells it that when you rollover the alpha should keep decreasing by 5 until it hits 0.

Then when you rollout the alpha should increase by 5 until it gets back to 100.

Why we did this on a movie clip: The onEnterFrame feature is what allows it to gradually fade. A simple rollOver function would only do the process once everytime you rolled over the button instance.

Thanks a ton…
U have been so helpful in many instances…
Knowing something is different than sharing it to many,…
and u have been a great source of such stuff…
pls keep up this good work…

Loving regds:)

I am glad I could help. I enjoy passing knowledge and helping others.

Thank you for your kind words.

Nice code, Lost. But if I may add something… :beam:

on (rollOver) {
	this.onEnterFrame = function() {
		this._alpha -= 5;
		if (this._alpha<=0) {
			this._alpha = 0;
			delete this.onEnterFrame;
		}
	};
}
on (rollOut) {
	this.onEnterFrame = function() {
		this._alpha += 5;
		if (this._alpha>=100) {
			this._alpha = 100;
			delete this.onEnterFrame;
		}
	};
}

pom :cowboy:

'DOH!!!

I knew it looked weird.

Thanks Ilyas… greatly appreciated :beam: