dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help! what am I doing wrong??

  1. #1

    Help! what am I doing wrong??

    I'm trying to fade in a movie clip when the user rolls over a button and then have it disapear when they roll off... the fla is attached..

    this is what I wrote:

    one_btn.onRollOver = function() {
    onEnterFrame = function() {
    if(test_mc._alpha <= 100){
    test_mc._alpha += 15;
    }
    }
    }
    one_btn.onRollOut = function() {
    test_mc._alpha = 0;
    }

    but when ever I roll out, the clip goes to 0 and then fades in again, even though I'm off the button... Any help would be appreciated..

    John
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Feb 2002
    Posts
    167
    do the opposite as on roll over
    if(test_mc._alpha >= 0){
    test_mc._alpha -= 15;

    i am not sure

    try

  3. #3
    Senior Member
    Join Date
    Nov 2000
    Location
    Malibu
    Posts
    251
    Your problem is that the onEnterFrame function is continuously running. Try this instead:
    code:

    btn_one._alpha = 0;
    btn_two._alpha = 0;
    // RollOver
    btn_one.onRollOver = function(){
    intervalID = setInterval(fadeIn,80,this);
    };
    btn_two.onRollOver = function(){
    intervalID = setInterval(fadeIn,80,this);
    };
    // RollOut
    btn_one.onRollOut = function(){
    clearInterval(intervalID);
    this._alpha = 0;
    };
    btn_two.onRollOut = function(){
    clearInterval(intervalID);
    this._alpha = 0;
    };

    function fadeIn(clip) {
    if (clip._alpha < 100) {
    clip._alpha += 5;
    } else {
    clearInterval(intervalID);
    }
    }

    www.electricbluemonkey.com

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