Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Movieclip: Fadein And Fadeout, Fades independent of movie timeline.
gsb
post May 27 2004, 11:35 AM
Post #1


Regular Dot
Group Icon
Group: *Premier*
Posts: 52
Joined: 22-May 04
From: Seattle
Member No.: 31





PURPOSE:
These two prototypes are applied to a movieclip to fade it in/out independent of the movie timeline and frame rate. Upon fading out the movieclip's _visibility attribute is set to false.

PROTOTYPE:
CODE
movieclip.prototype.fadeIn=function(a,s) {
    if(typeOf(a)!="number") a=1;
    if(typeOf(s)!="number") s=50;
    if(!this._visible) this._visible=true;
    if(this.gsbLoop) clearInterval(this.gsbLoop);
    this.gsbLoop=setInterval( function() {
            if((arguments[0]._alpha+=arguments[1])>=100) {
                arguments[0]._alpha=100;
                clearInterval(arguments[0].gsbLoop);
            }
            updateAfterEvent();
        }, s, this, a );
};
movieclip.prototype.fadeOut=function(a,s) {
    if(typeOf(a)!="number") a=1;
    if(typeOf(s)!="number") s=50;
    if(this.gsbLoop) clearInterval(this.gsbLoop);
    this.gsbLoop=setInterval( function() {
            if((arguments[0]._alpha-=arguments[1])<=0) {
                arguments[0]._alpha=0;
                arguments[0]._visible=false;
                clearInterval(arguments[0].gsbLoop);
            }
            updateAfterEvent();
        }, s, this, a );
};


USAGE: movieclip.fadeIn( amount, speed ); and movieclip.fadeOut( amount, speed );
Where: amount is the movieclip's _alpha property increment or decrement, and
speed is the number of milliseconds between changes.

EXAMPLE:
CODE
movieclip.fadeIn( 1, 50 );
 
+Quote Post  Go to the top of the page
oliverp
post Mar 4 2005, 09:06 PM
Post #2


New Member
Group Icon
Group: Member
Posts: 9
Joined: 4-March 05
Member No.: 2,397





this site is awesome...thanx man
 
+Quote Post  Go to the top of the page
Eddie_K
post Mar 5 2005, 02:25 AM
Post #3


Hush now, I'm thinking...
Group Icon
Group: *Premier*
Posts: 3,977
Joined: 25-May 04
From: Heaven
Member No.: 47





oliverp 2.8.00008B.Welcome to 13dots.com.png Posts: 0 ? blink.gif

Great stuff Greg bigwink.gif Thanks for sharing with us bigwink.gif

Eddie
 
+Quote Post  Go to the top of the page
ravex
post Jan 20 2006, 12:48 PM
Post #4


New Member
Group Icon
Group: Member
Posts: 3
Joined: 19-January 06
Member No.: 9,089





don't work Sad.gif or I don't understand. please explain step-by-step
 
+Quote Post  Go to the top of the page
tjbeta
post Nov 19 2008, 01:09 AM
Post #5


Getting Used To The Dots
Group Icon
Group: Member
Posts: 31
Joined: 12-March 05
Member No.: 2,601



I've been looking for a tutorial like this THANK YOU:)
 
+Quote Post  Go to the top of the page

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 29th July 2010 - 10:52 PM
Find jobs | Full and Final offers | Property in Cyprus | Compare Savings | Mortgages