Professional Web Applications Themes

Fading alpha on mouse over/mouse off - Macromedia Flash

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 ...

  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. #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" <NOSPAMnljlineone.net> wrote in message
    news:bdku7e$ualj5$1ID-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

  3. #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

Similar Threads

  1. Help with Mouse Within and Mouse Leave problem...
    By Khanh75 webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 2
    Last Post: December 3rd, 08:22 PM
  2. change button alpha on mouse over
    By miro20 webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: October 24th, 11:53 AM
  3. Move mouse cursor to X,Y location and simulate mouse click
    By WZSun in forum Macromedia Director Lingo
    Replies: 1
    Last Post: August 6th, 10:17 AM
  4. changing alpha on mouse within
    By Andrew Morton in forum Macromedia Director Basics
    Replies: 0
    Last Post: July 7th, 04:29 PM
  5. Replies: 0
    Last Post: June 29th, 02:30 PM

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