A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: invisible mc fade in

  1. #1
    Member
    Join Date
    Nov 2004
    Posts
    35

    invisible mc fade in

    HI

    I have an mc on stage with visibility set to false. Now when I press a button I want it to fade in. (I can have it appear by turning the visibility on but want the alpha to fade in)

    SEb

  2. #2
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi..
    Well you could have a movieclip(instance name.....mc)
    and a button(name...btn)...on the stage....then put this on the keyframe.....
    code:
    mc._alpha = 0;
    fadeup = false;
    btn.onPress = function() {
    fadeup = true;
    };
    mc.onEnterFrame = function() {
    if (fadeup == true) {
    mc._alpha++;
    }
    };


    basically the code is stating ...

    when the variable(fadeup)comes to equal....true...then the alpha value goes up by increments ....

  3. #3
    Member
    Join Date
    Nov 2004
    Posts
    35
    HI HUM

    Thanks for typing up the code!!

    The reason for setting the visibility off is that I have buttons in the mc which would be active if only the alpha is set to 0.

    Here is the code I have on the button which should fade in the mc.
    (I would love to put this code on the main timeline but could not get the paths to work)

    on (release) {
    gotoAndStop(2);
    this._parent.infoTxt_mc._visible = true;
    this._parent.infoTxt_mc._alpha = 0;
    this._parent.infoTxt_mc._alpha++;
    }

    this is probably not the most elegant way to write this, and it the last part which should fade in the alpha doesn't work.

    Any thoughts?

    SEb

  4. #4
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi Sebbjo...
    If you post your fla. in MX format(Save as/Options)....i dont have mx2004 yet........i will take a look for you

  5. #5
    .: Weirded Out :. The_Xell's Avatar
    Join Date
    Nov 2002
    Location
    Under the table and dreaming...
    Posts
    802
    Put an if statement in the button and use alpha=0 to fade it in:

    Code:
    if(_parent._alpha==100){
    //the button AS
    }

  6. #6
    Member
    Join Date
    Nov 2004
    Posts
    35
    here it is

    Thanks so far

    SEb
    Attached Files Attached Files

  7. #7
    Member
    Join Date
    Nov 2004
    Posts
    35
    Xell

    I tried inserting the code but am not exactly sure why it doesn't work.

    Can you be more specific

    SEb

  8. #8
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi again....

    click into your infoTxtmc.....and you will see added tweens for a fade in and out......actions on the buttons tell the movie which frame to play.....

  9. #9
    Member
    Join Date
    Nov 2004
    Posts
    35
    HUM

    your the man!!

    just wondering if it's possible to do this by code instead of tweens.

    Another thing I'm struggling with is to put the code on the main timeline instead of the button but can't figure ร*t out.

    Otherwise trazillion thanks

    SEb


  10. #10
    Senior Member hum's Avatar
    Join Date
    Sep 2003
    Location
    CloudCuckooland
    Posts
    1,714
    Hi Sebbjo...

    Here it is again without the tween .....using variables instead to control the fade....actions are on main keyframe....and both buttons..........i prefer the tweened version as it is quicker!

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