Welcome to WebmasterWorld Guest from 54.163.35.238

Forum Moderators: open

Message Too Old, No Replies

Flash 8 Functions

Using them on rollovers?

     

ffoeg

12:07 pm on Apr 24, 2007 (gmt 0)

5+ Year Member



I apologize in advance, I am a heavy n00b when it comes to flash. Only used it once or twice before.

But I have a problem with my flash. I have defined a function, and I would like to use that function on the rollOver state of a button, in order to make the button fade in. I'd rather not be using tweens.

This is my code so far (shortened):

function fadeIn (instance) {
while (instance._alpha < 100) {
instance._alpha += 20;
}
}
btn_name._alpha = 40;
btn_name.onRollOver = fadeIn(instance_name);

The problem that I get is that when I roll over the button, the alpha isn't incremented. It is set at 119.53125 straight away.

Maybe I'm referencing the function incorrectly, I don't know. But this is really frustrating me. If anyone can help, I would really appreciate it.

Thanks
*g

rsndll

1:36 pm on Apr 24, 2007 (gmt 0)

5+ Year Member



I think you would need to add a delay in the incrementation loop. Otherwise it is incrementing so quickly that you don't see the fade effect.

Unfortunately, I'm not an expert either so I don't know how to do that.

ffoeg

3:12 pm on Apr 24, 2007 (gmt 0)

5+ Year Member



I've tried to change the code that it doesn't do it right away. It now only increments it on entering the frame. Here's the new batch of code:

function utilFadeOut (instance) {
instance.onEnterFrame = function() {
if (instance._alpha >= 40) {
instance._alpha -= 20;
}
}
}
 

Featured Threads

Hot Threads This Week

Hot Threads This Month