# onRollOver AS

**URL:** <https://forum.kirupa.com/t/onrollover-as/178434>\
**Category:** flash\
**Created:** [February 10, 2006, 3:00pm UTC](https://forum.kirupa.com/t/onrollover-as/178434 "2006-02-10T15:00:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [February 10, 2006, 3:00pm UTC](https://forum.kirupa.com/t/onrollover-as/178434/1 "2006-02-10T15:00:35Z")

</div>

just need to execute a function - myFunction() when roll over a button

i can do it coding the button like so:

[AS]on (rollOver) {  
\_root.myFunction(this);  
}[/AS]

or code it in the root where i defined the function, like so:

[AS]myButton.onRollOver = function() {  
myFunction(this);  
}[/AS]

the thing is, i’m using this for a tween class animation, and when i code it directly in the button it works fine

can i write this AS diferent way?!  
myButton.onRollOver = function() {  
myFunction(this);  
}

thx  
am
