I’ve found the code below in a thread and wondered where I would add
on (rollOver) {
this.swapDepths(3);
}
on (rollOut) {
this.swapDepths(1);
}
so that I can use multiple examples of the same code in boxes on screen
onClipEvent (load) {
this._alpha = 30; //set original alpha
}
onClipEvent (enterFrame) {
function fadeOut() {
if (this._alpha>30) {
this._alpha -= 10;
} else {
this.onEnterFrame = null;
}
}
// this function increases the _alpha of the object calling it
// when it reaches 100, it deletes its enterFrame
function fadeIn() {
if (this._alpha<100) {
this._alpha += 10;
} else {
this.onEnterFrame = null;
}
}
this.onRollOver = function() {
// when you roll over the button, you define its enterFrame as the
// function you have just declared. You could hard code it, but it is
// clearer that way and more reusable
this.onEnterFrame = fadeIn;
};
this.onRollOut = function() {
this.onEnterFrame = fadeOut;
};
}