A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Fade out function

  1. #1
    The Doctor Gonzo
    Join Date
    Feb 2003
    Location
    Misiones - Argentina
    Posts
    71

    Fade out function

    Hi there guys,
    I have this code in flash (AS2)... check it out:

    interior._visible = false;
    back._visible = false;

    function fadeout() {
    onEnterFrame = function () {
    this._alpha -= 10;
    if (this._alpha <= 0) {
    this._alpha = 0;
    delete onEnterFrame;
    }
    }
    }

    gointerior.onRelease = function() {
    interior._visible = true;
    interior.gotoAndPlay(2);
    fadeout();
    };

    stop();


    I have a couple of movie clips in the layout, and a button called "gointerior"
    The idea is that when I release that button, it fades out (the button). So I have created a function called fadeout(); but when I call that function and I test the movie all the movie fades out. I dont know what Im doing wrong. I think that is something related to the function path or something.
    I need your help guys!
    Last edited by fabrizzzio; 06-08-2007 at 09:19 AM. Reason: mistake
    need a light?

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    try sending the clip name as a parameter -
    Code:
    function fadeout(clip) {
    clip.onEnterFrame = function () {
    clip._alpha -= 10;
    if (clip._alpha <= 0) {
    clip._alpha = 0;
    delete onEnterFrame;
    }
    }
    }
    
    gointerior.onRelease = function() {
    interior._visible = true;
    interior.gotoAndPlay(2);
    fadeout(this);
    // or - fadeout(gointerior);
    };

  3. #3
    The Doctor Gonzo
    Join Date
    Feb 2003
    Location
    Misiones - Argentina
    Posts
    71
    doesn't work
    Is there something related to the function?
    need a light?

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you've stuffed up somewhere
    it works here -
    Last edited by a_modified_dog; 08-17-2007 at 06:33 PM.

  5. #5
    The Doctor Gonzo
    Join Date
    Feb 2003
    Location
    Misiones - Argentina
    Posts
    71
    Thanks a lot man!
    that's working.
    the problem was that I was using a Button symbol, and I cannot associate an onEnterFrame statement to buttons...
    so I decide tu use a MC to get the onEnterFrame from it out of the button.
    need a light?

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