homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

adjust speed of alpha change?

5+ Year Member

Msg#: 4058530 posted 7:30 pm on Jan 11, 2010 (gmt 0)


I have the following simple function to change the _alpha value.

function fadeIn() {
this._alpha += 25;

I assign this function to my movie clips:

greybar1_mc.onEnterFrame = fadeIn;
greybar2_mc.onEnterFrame = fadeIn;
menu_mc.onEnterFrame = fadeIn;
t_username.onEnterFrame = fadeIn;

The problem is that its all happening rather quickly.

Is it possible to adjust the speed and maybe also add an Easy In ?




WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4058530 posted 8:51 pm on Jan 11, 2010 (gmt 0)

In frame 1 of the main movie,

var fadeIncrement:Number=25;
var fadeSpeed:Number=0.5;


greybar1_mc.onEnterFrame = setTimeout(_root.fadeSpeed,fadeIn());
greybar2_mc.onEnterFrame = setTimeout(_root.fadeSpeed,fadeIn());
menu_mc.onEnterFrame = setTimeout(_root.fadeSpeed,fadeIn());
t_username.onEnterFrame = setTimeout(_root.fadeSpeed,fadeIn());


function fadeIn() {
this._alpha += _root.fadeIncrememt;

This may not be entirely correct but is posted for an idea. The idea is you should be able to control the "fade speed" via setTimeout(). You may have to monitor the value of setTimeout and apply clearTimeout() to avoid recursive problems with setTimeout. See manual, don't have working code handy. :-)

Also note the movement of "25" to a variable that can be accessed by any object, this allows you to put all your variables in one place, frame 1 AS layer.

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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved