Welcome to WebmasterWorld Guest from 54.234.244.30

Forum Moderators: open

Message Too Old, No Replies

Flash 8 Functions

Using them on rollovers?

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

Junior Member

10+ Year Member

joined:Dec 29, 2005
posts:73
votes: 0


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

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

New User

5+ Year Member

joined:Mar 22, 2006
posts:38
votes: 0


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.

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

Junior Member

10+ Year Member

joined:Dec 29, 2005
posts:73
votes: 0


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;
}
}
}
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members