Professional Web Applications Themes

fading in and out - Macromedia Flash Sitedesign

I have two similar scenarios I don't know how to script. Basically they both involve having a symbol fade in and then out on command. They both would be part of a photo show. I'd like to roll over a button and have a text block fade in. And then when I roll out have it fade out. Similarly, I'd like to have a picture fade in and then stop. And then when I would click either a next or previous button have it fade out before the next image fades in. Is there some easy script here I am ...

  1. #1

    Default fading in and out

    I have two similar scenarios I don't know how to script. Basically they both involve having a symbol fade in and then out on command. They both would be part of a photo show. I'd like to roll over a button and have a text block fade in. And then when I roll out have it fade out. Similarly, I'd like to have a picture fade in and then stop. And then when I would click either a next or previous button have it fade out before the next image fades in.

    Is there some easy script here I am missing (On MX)?? Getting something to fade in on command is pretty easy. But the fading out is beyond my simple mind.

    Thanks for any help.



    Will Y. webforumsuser@macromedia.com Guest

  2. #2

    Default Re: fading in and out

    I think you have to change the alpha or tint of the items in question. Try
    that.

    hth

    TL



    "Will Y." <webforumsusermacromedia.com> wrote in message
    news:buqdr9$ra7$1forums.macromedia.com...
    > I have two similar scenarios I don't know how to script. Basically they
    both involve having a symbol fade in and then out on command. They both
    would be part of a photo show. I'd like to roll over a button and have a
    text block fade in. And then when I roll out have it fade out. Similarly,
    I'd like to have a picture fade in and then stop. And then when I would
    click either a next or previous button have it fade out before the next
    image fades in.
    >
    > Is there some easy script here I am missing (On MX)?? Getting something
    to fade in on command is pretty easy. But the fading out is beyond my
    simple mind.
    >
    > Thanks for any help.
    >
    >
    >

    Todd Guest

  3. #3

    Default Re: fading in and out

    Tw functions: one for fading in, one for fading out:

    // fading functions
    fadeOut = function (mc, step, target) {
    mc.onEnterFrame = function() {
    newAlpha = mc._alpha - step;
    if (newAlpha <= target) {
    newAlpha = target;
    delete mc.onEnterFrame;
    }
    mc._alpha = newAlpha;
    };
    };
    fadeIn = function (mc, step, target) {
    mc.onEnterFrame = function() {
    newAlpha = mc._alpha + step;
    if (newAlpha >= target) {
    newAlpha = target;
    delete mc.onEnterFrame;
    }
    mc._alpha = newAlpha;
    };
    };

    Parameter explanations:
    mc = the movieclip you want to fade in or out
    step = the speed of fading: higher is faster
    target = final alpha; so if you want to fade to 20%, use 20.

    Example use:
    // in this example the buttons are movieclips that on rollover will fade
    themsleves (hence 'this')
    btn01_btn.onRollOver = function () {
    fadeOut(this, 5, 20);
    };
    btn01_btn.onRollOut = function () {
    fadeIn(this, 5, 90);
    };

    --

    John
    ----------------------------------------------------------------------------
    -----------
    RESOURCES
    [url]http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash[/url]
    ----------------------------------------------------------------------------
    -----------
    TUTORIALS at
    [url]www.laiverd.com[/url]
    Flash & PHP Emailform
    Using textfiles in Flash
    ----------------------------------------------------------------------------
    -----------


    Laiverd.COM Guest

  4. #4

    Default Re: fading in and out

    You might be able to just use one function for both fade in and out if you include negative steps
    something like

    fadeOut = function (mc, step, target) {
    mc.onEnterFrame = function() {
    newAlpha = mc._alpha-step;
    if (Math.abs(target-newAlpha)<=step) {
    newAlpha = target;
    delete mc.onEnterFrame;
    }
    mc._alpha = newAlpha;
    };
    };
    btn01_btn.onRollOver = function() {
    fadeOut(this, 5, 20);
    };
    btn01_btn.onRollOut = function() {
    fadeOut(this, -5, 90);
    };


    Certified but not by Macromedia!
    myurl
    stwingy webforumsuser@macromedia.com Guest

Similar Threads

  1. Fading In
    By TazJaali in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: February 17th, 07:34 AM
  2. Fading In
    By Ibis Fernandez // flashfilmmaker.com in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 17th, 07:09 AM
  3. Graphics fading in and out
    By SubGum webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 2
    Last Post: February 5th, 09:03 PM
  4. Fading
    By Ruku webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: November 12th, 10:02 PM
  5. Ink - Add-Pin and fading it out
    By Andrew Morton in forum Macromedia Director Lingo
    Replies: 0
    Last Post: September 2nd, 07:51 AM

Bookmarks

Posting Permissions

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

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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139