# Weird RollOver-RollOut

**URL:** <https://forum.kirupa.com/t/weird-rollover-rollout/282423>\
**Category:** flash\
**Created:** [February 21, 2009, 9:39pm UTC](https://forum.kirupa.com/t/weird-rollover-rollout/282423 "2009-02-21T21:39:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![asthyanax](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asthyanax](https://forum.kirupa.com/u/asthyanax)\
**Post date:** [February 21, 2009, 9:39pm UTC](https://forum.kirupa.com/t/weird-rollover-rollout/282423/1 "2009-02-21T21:39:09Z")

</div>

Hi,  
I have something that drives me crazy and hopefully someone will be able to help me.  
I have a clip(button) with a rollover that shows like a submenu. When I rollover that clip I play the RollOver animation then I use a boolean to test is the animation is fully played. I do that just in case I rollOut the clip(button) before the animation is fully played or not. Then I have the rollOut state on that clip played. The problem is I have other clips on that clip with rollOver/rollOut states and it acts weird.  
I understand that a little bit confusing, so here’s the code I use. Feel free to give me a better solution.

```php

//CLIP Button
bt.onRollOver=function():Void{
    _global.flagOver=false;
    fOver( _global.flagOver);
}

bt.onRollOut=function():Void{    
    if(_global.flagOver){
        fOut();    
    }
}

//functions
function fOver(flag:Boolean):Void{
    trace("OVER")
    mcOver.onEnterFrame=function():Void{
        this.nextFrame();
    }
}

function fOut():Void{
    trace("OUT")    
    mcOver.onEnterFrame=function():Void{
        this.prevFrame();
        if (this._currentframe == this._totalframes) {
            delete this.onEnterFrame;
        }
    };            
}

//clips inside mcOver
for (var i:Number = 1; i<=NUMBER_AVATARS; i++) {
    avatarId = this["avatar"+i];
    avatarUrl = _root.AVATAR_FOLDER+["avatar-"+i]+".png";
    avatarId.imgUrl = avatarUrl;
    avatarId.imgWidth = 70;
    avatarId.imgHeight = 70;
    avatarId.Id = i;
    this["avatar"+i].onRollOver = function():Void {
        TweenMax.to(this,_root.layoutSpeed,{glowFilter:{color:0xffffff, alpha:1, blurX:30, blurY:30, quality:3}, ease:_root.mainTween});
    };
    this["avatar"+i].onRollOut = function():Void {
        TweenMax.to(this,_root.layoutSpeed,{glowFilter:{color:0xffffff, alpha:0, blurX:30, blurY:30, quality:3}, ease:_root.mainTween});
    };
    this["avatar"+i].onRelease = this["avatar"+i].onReleaseOutside=function ():Void {
        _root.updateAvatar(this.Id);
        TweenMax.to(this,_root.layoutSpeed,{glowFilter:{color:0xffffff, alpha:0, blurX:30, blurY:30, quality:3}, ease:_root.mainTween});
    };

}

```

For any reasons, when I have the code on that clips, it doesn’t work. Hope, you can help me on that, after a day, I’m completely lost. Sorry if I don’t post the fla…there’s many nested fla and too complicated to isolate this one.  
Thank you for your help…or just advices for a better way to do that.

P.S  
I just figured it out that of course I ave buttons with rollover/rollout and my clip underneeth them has a rollover/rollout function too.
