A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: fade - alpha

Hybrid View

  1. #1
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235

    fade - alpha

    does anyone know a way that I can tell movieclip to fade by placing the code in a frame. I've seen ways of doing it using buttons but when I try to redo the code it doesn't work.

    basically I have 4 frames with 4 different movies in them. When you go to, lets say, frame 2 movieclip 2 fades. When you go to frame 3 movieclip 3 fades and etc.

    Any ideas or tutorials. Never used alpha before.

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    code:

    function fade(target, destination) {
    rate = 10;
    target.onEnterFrame=function() {
    rate = rate*.95;
    if (this._alpha == destination) {
    delete this.onEnterFrame;
    }
    this._alpha += Math.round((destination-this._alpha)/rate);
    }
    }



    put that in frame 1 of main timeline.

    anytime you want to use it on a mc, just put fade(x,xx) and substitute the thing you want to fade for "x" and the alpha you want it to get to for the "xx", like this

    code:

    on(press) {
    fade(_root.somemcinstancename, 0);
    }


  3. #3
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235
    Thanks worked swell...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center