# Rollover button

**URL:** <https://forum.kirupa.com/t/rollover-button/298007>\
**Category:** Uncategorized\
**Created:** [October 12, 2009, 9:16am UTC](https://forum.kirupa.com/t/rollover-button/298007 "2009-10-12T09:16:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonas1976](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@jonas1976](https://forum.kirupa.com/u/jonas1976)\
**Post date:** [October 12, 2009, 9:16am UTC](https://forum.kirupa.com/t/rollover-button/298007/1 "2009-10-12T09:16:34Z")

</div>

What’s Happening with the buttons? when i click for a instants the color stays green in the buttons 8-]

I have this

```php
var ativo:MovieClip = teste2;
ativo.gotoAndStop(5);
var swf:MovieClip;
var loader:Loader = new Loader();
var defaultSWF:URLRequest=new URLRequest("swfs/teste2.swf");
addChild(loader);
loader.load(defaultSWF);
function btnClick(event:MouseEvent):void {
    if (ativo != null) {
        if (event.currentTarget.name != ativo.name) {
            event.currentTarget.gotoAndPlay(2);
            trace(event.currentTarget.name);
            defaultSWF = new URLRequest("swfs/"+event.currentTarget.name+".swf");
            loader.load(defaultSWF);
            ativo.gotoAndPlay(6);
            ativo = MovieClip(event.currentTarget);
        }
    } else {
        event.currentTarget.gotoAndPlay(2);
        trace(event.currentTarget.name);
        defaultSWF = new URLRequest("swfs/"+event.currentTarget.name+".swf");
        loader.load(defaultSWF);
        ativo = MovieClip(event.currentTarget);
    }
}
teste.addEventListener(MouseEvent.CLICK, btnClick);
teste2.addEventListener(MouseEvent.CLICK, btnClick);
teste3.addEventListener(MouseEvent.CLICK, btnClick);
teste.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
teste.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
teste2.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
teste2.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
teste3.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
teste3.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);

function onButtonOver(e:MouseEvent):void {
    if (e.currentTarget.name != ativo.name) {
        e.currentTarget.gotoAndPlay(2);
    }
}

function onButtonOut(e:MouseEvent):void {
    if (e.currentTarget.name != ativo.name) {
        e.currentTarget.gotoAndPlay(6);
    }
}

```

and the example  
[http://rapidshare.com/files/291927039/teste.fla.html](http://rapidshare.com/files/291927039/teste.fla.html)
