Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 4 of 4

Thread: fade in and out effect

  1. #1
    159
    posts
    Registered User

    fade in and out effect

    I have a few images that I want them to appear fade in while my mouse is over each of them. My question is, do I have to define an proper area to make it work? For now on, it's ONLY work once when I first load my.swf

    ps: It won't recognize the area if I first define image1_mc._visible = false; image2_mc._visible = false;

    Please help!

    Here's my current:


    // I don't want them to appear at beginning
    image1_mc._alpha = 1;
    image2_mc._alpha = 1;

    // Fade in while my mouse is on
    image1_mc.onRollOver = function() {
    this._alpha = 20;
    image1_mc.onEnterFrame = function() {
    this._alpha += 5;
    }
    }

    // Fade out
    image1_mc.onRollOut = function() {
    this._visible = false;

    }

  2. #2
    1,839
    posts
    Registered User
    set _alpha to 0 and theyll be invisible but still respond to rollovers and press

    the easiest way to set it up would be

    // Fade in while my mouse is on
    image1_mc.onRollOver = function() {
    new mx.transitions.Tween(this,"_alpha",undefined,this. _alpha,100,20)
    }

    // Fade out
    image1_mc.onRollOut = function() {
    new mx.transitions.Tween(this,"_alpha",undefined,this. _alpha,0,20)
    }

  3. #3
    159
    posts
    Registered User
    It's working great!
    Is there a way to do if this image is found while clicking it then it won't do the alpha again, the alpha will only work for the other image

    var isFound:Boolean;

    // Fade in while my mouse is on
    image1_mc.onRollOver = function() {
    if(!isFound) {
    new mx.transitions.Tween(this,"_alpha",undefined,this. _alpha,100,20)
    }
    }

    // Fade out
    image1_mc.onRollOut = function() {
    if(!isFound) {
    new mx.transitions.Tween(this,"_alpha",undefined,this. _alpha,0,20)
    }
    }

  4. #4
    159
    posts
    Registered User
    nevermind, I found a way to do it!
    thanks a lot!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012