PDA

View Full Version : changing _alpha on mouseover


interfacer
11-24-2004, 06:19 AM
ok...i know i'm doing this wrong, but i dont understand what i've missplaced. if anyone could help me out :)

i have a button, and here is the as i have on the button:


on(rollOver){
while(this.alpha<50){
this.alpha=this.alpha+5;
}
}
on(rollOut){
while(this._alpha>0){
this._alpha=this._alpha-5;
}
}


all i want it to do is for the alpha to go to 50 on the rollover, and back to 0 on the rollOut. am i using the wrong thing? do i need it to be an MC? a Button? a Graphic? do i need to give it a timeline? help! :) thanks!

skjc
11-24-2004, 08:25 AM
if you just want it to go to 50 on rollover and 0 on rollout then this code is fine:

on(rollOver) {
this._alpha=50;
}
on(rollOut) {
this._alpha=0;
}

it is applied to the button instance. this means put the button on the stage, select it and bring up the actions panel (f9). it will be showing actions button as the heading. enter the code and test it.

interfacer
11-24-2004, 05:59 PM
yes, but i want it to fade in and fade out in an animated manner. what additions to the code would i make?

thebloodpoolkid
11-24-2004, 08:46 PM
Try these threads, maybe it will help some.
http://www.actionscript.org/forums/showthread.php3?t=13613&highlight=movieclip+rollover+fade+in%2Fout

http://www.actionscript.org/forums/showthread.php3?t=53614&highlight=fade+button

interfacer
11-25-2004, 01:46 AM
hey thanks, its working like a charm now! i'll use the search function before i star posting in the forums next time.