# Code question

**URL:** <https://forum.kirupa.com/t/code-question/98911>\
**Category:** Uncategorized\
**Created:** [January 12, 2004, 8:33pm UTC](https://forum.kirupa.com/t/code-question/98911 "2004-01-12T20:33:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hangaglot](https://avatars.discourse-cdn.com/v4/letter/h/bc8723/32.png) [@hangaglot](https://forum.kirupa.com/u/hangaglot)\
**Post date:** [January 12, 2004, 8:33pm UTC](https://forum.kirupa.com/t/code-question/98911/1 "2004-01-12T20:33:04Z")

</div>

in the first frame of a movieclip i have placed the following code to simulate a button. [AS]  
this.onRollOver=function(){  
trace(“onRollOver”);  
gotoAndStop(2);  
}  
this.onRollOut=function(){  
gotoAndStop(1);  
}  
this.onPress=function(){  
gotoAndStop(3);  
}  
this.onRelease=function(){  
gotoAndStop(2);  
}  
[/AS]  
and on the instance of the movieclip i placed the following code

```auto

on(rollOver){
	trace("rollover");
}

```

and it traces  
rollover  
onRollOver  
which is great and exactly what i had hoped it would do, but i did not expect it as i thought the on(rollOver) overrode the onRollOver function handler in the first frame?

or are these 2 seperate events that get fired and i could just as well go

```auto

this.rollover=function(){

};

```

which does not work. what is going on here?
