Fading alpha on mouse over/mouse off

Ask a Question related to Macromedia Flash, Design and Development.

  1. #1

    Default Fading alpha on mouse over/mouse off

    Hi,
    Wondering if someone could take a minute to help a flash newbie:
    I'm trying to create a set of images which fade to 1% alpha when the mouse
    is over them and back up to 99% when the mouse is no longer on them. I've
    found this actionscript to do it which works with a move clip of a fading
    image:
    this.onRollOver = function() {
    this.onEnterFrame = function() {
    if (this._currentframe != this._totalframes) {
    this.nextFrame();
    } else {
    delete this.onEnterFrame;
    }
    };
    };
    this.onRollOut = function() {
    this.onEnterFrame = function() {
    if (this._currentframe != 1) {
    this.prevFrame();
    } else {
    delete this.onEnterFrame;
    }
    };
    };
    stop();

    The trouble is, i'd prefer it if it faded out faster than it faded back in,
    so the images disappears quite quickly, but takes a while longer to fade
    back in. Can anyone suggest how I can acheive this?
    Any help greatly appreciated, thanks in advance...


    Fry Guest

  2. Similar Questions and Discussions

    1. Help with Mouse Within and Mouse Leave problem...
      I have a shockwave 3d file of a building with individual floors split up into seperate objects. I want a pop-up information box (set at a MARKER)...
    2. change button alpha on mouse over
      Hi I have made plain rectangular buttons for a movie and have set the 'transparent' option to 40% so that the background shows through and the...
    3. Move mouse cursor to X,Y location and simulate mouse click
      Hi, Just something that slip my mind.. but how do you move the mouse cursor to a sprite member and simulate a mouse click? Any help is...
    4. changing alpha on mouse within
      Assuming you've set the blend to 50% in Director you can do it with a behaviour attached to the sprite:- property spriteNum on mouseEnter...
    5. ps/2 mouse is not loaded by the kernel (neither is usb mouse)
      I've been looking all over the net trying trying to solve this problem, I found a few posts where people had the same problem, but no solution. ...
  3. #2

    Default Re: Fading alpha on mouse over/mouse off

    You can simplify by not checking for first or last frames. (Flash takes
    care of that)
    Here is the way I would do it... It's just a variation of the same thing,
    but I like easy to read code.

    good luck,
    tf

    //----------------------------------------------------------------------
    // All code goes on first frame of movie clip
    this.onEnterFrame = function()
    {
    if(goforward)
    this.nextFrame();
    else // back up
    {
    // Multiple lines make it back up faster
    this.prevFrame();
    this.prevFrame();
    this.prevFrame();
    }
    }

    this.onRollOver = function()
    {
    goforward = 1; // yes
    }

    this.onRollOut = function()
    {
    goforward = 0; // no
    }
    //----------------------------------------------------------------------



    "Fry" <NOSPAMnlj@lineone.net> wrote in message
    news:bdku7e$ualj5$1@ID-100008.news.dfncis.de...
    > Hi,
    > Wondering if someone could take a minute to help a flash newbie:
    > I'm trying to create a set of images which fade to 1% alpha when the mouse
    > is over them and back up to 99% when the mouse is no longer on them. I've
    > found this actionscript to do it which works with a move clip of a fading
    > image:
    > this.onRollOver = function() {
    > this.onEnterFrame = function() {
    > if (this._currentframe != this._totalframes) {
    > this.nextFrame();
    > } else {
    > delete this.onEnterFrame;
    > }
    > };
    > };
    > this.onRollOut = function() {
    > this.onEnterFrame = function() {
    > if (this._currentframe != 1) {
    > this.prevFrame();
    > } else {
    > delete this.onEnterFrame;
    > }
    > };
    > };
    > stop();
    >
    > The trouble is, i'd prefer it if it faded out faster than it faded back
    in,
    > so the images disappears quite quickly, but takes a while longer to fade
    > back in. Can anyone suggest how I can acheive this?
    > Any help greatly appreciated, thanks in advance...
    >
    >

    tralfaz Guest

  4. #3

    Default Re: Fading alpha on mouse over/mouse off

    > You can simplify by not checking for first or last frames. (Flash
    > takes care of that)
    > Here is the way I would do it... It's just a variation of the same
    > thing, but I like easy to read code.
    >
    > good luck,
    > tf
    <Snip!>

    Thank you VERY much indeed!


    Fry Guest

Posting Permissions

  • You may not post new threads
  • You may 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