«

»

Jan 03

Scripted Fade In / Out

swishmax 4 scripted fade in / out tutorial.


First Of All:
open swishmax 4 and set movie width and height 25 frame rate.
create a movieclip of whatever it is you want to fade in/ out.
this will be a button fade in fade out action. so add the following to your movieclip.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
onSelfEvent (load) {
    /*
    simple scripted fade in / out script
    by Craig Lowe
    www.loweonline.co.uk
    www.swish-designs.co.uk
    */
    fading=true; // fade out on start false
    alpha=100; // makes object opaque
    fadeSpeed=3; // how quick the fade is
}
onSelfEvent (enterFrame) {
    this.onRollOver = function(){
    fading=false; 
    }
    this.onRollOut = function(){
    fading=true; 
    }
    if(fading && alpha>0){
        alpha-=fadeSpeed;
        this._alpha=alpha;
    }
    if(!fading && alpha<100){
        alpha+=fadeSpeed;
        this._alpha=alpha;
    }
}


VN:F [1.9.22_1171]
Rating: 4.8/5 (5 votes cast)
VN:F [1.9.22_1171]
Rating: +4 (from 4 votes)
Scripted Fade In / Out, 4.8 out of 5 based on 5 ratings

Leave a Reply

7 visitors online now
3 guests, 3 bots, 1 members
Max visitors today: 13 at 05:12 am UTC
This month: 27 at 05-17-2013 01:24 pm UTC
This year: 39 at 01-01-2013 12:46 pm UTC
All time: 109 at 12-07-2012 11:00 pm UTC