homepage Welcome to WebmasterWorld Guest from 54.198.148.191
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Flash 8 Functions
Using them on rollovers?
ffoeg




msg:3319888
 12:07 pm on Apr 24, 2007 (gmt 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

 

rsndll




msg:3319952
 1:36 pm on Apr 24, 2007 (gmt 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.

ffoeg




msg:3320055
 3:12 pm on Apr 24, 2007 (gmt 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;
}
}
}

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved