Looping question

what am I doing wrong???

currentThumb.onRollOver = currentThumb.onDragOver = function(){
this._alpha = 40;

}
currentThumb.onRollOut = currentThumb.onDragOut = function(){
while (alpha < 100){
alpha+=1;
this._alpha = alpha;
}

}

what im trying to do:

onRollover the alpha changes to 30. onRollout the alpha changes to 100 in steps. ie. fading in

please help

Use an [font=courier new]onEnterFrame[/font] handler or [font=courier new]setInterval[/font] instead of the [font=courier new]while[/font] statement. :slight_smile:

function fadein() {
	this._alpha = Math.min(100, ++this._alpha);
	if (this._alpha == 100) {
		delete this.onEnterFrame;
	}
}
currentThumb.onRollOver = function() {
	this._alpha = 30;
};
currentThumb.onRollOut = function() {
	this.onEnterFrame = fadein;
};
//
function fadein() {
	currentThumb._alpha = Math.min(100, ++currentThumb._alpha);
	if (currentThumb._alpha == 100) {
		clearInterval(intervalid);
	}
}
currentThumb.onRollOver = function() {
	this._alpha = 30;
};
currentThumb.onRollOut = function() {
	intervalid = setInterval(fadein, 1000/12);
};