# On(event) call function

**URL:** https://forum.kirupa.com/t/on-event-call-function/249208
**Category:** Uncategorized
**Created:** [January 16, 2008, 3:09pm UTC](https://forum.kirupa.com/t/on-event-call-function/249208 "2008-01-16T15:09:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)
#### Post date: [January 16, 2008, 3:09pm UTC](https://forum.kirupa.com/t/on-event-call-function/249208/1 "2008-01-16T15:09:39Z")

</div>

Hey,  
I pretty much am just looking for a more ‘elegant’ way to perform the same action below:

```auto

menu.onLoad = function(sucess){
	var mClip:MovieClip = main.createEmptyMovieClip("menuClip",main.getNextHighestDepth());
	drawSquare(mClip,200,65,0xeeee00,100);
	mover(mClip);
	mClip.onRollOver = function(){
		mOver(this);
	}
	mClip.onRollOut = function(){
		mOut(this);
	}							
}

```

the mover function calls an onEnterFrame and as you can see the rollovers are calling other functions. Is there a better way to write such functions? It works fine the way it is, but there must be a better way to perform that.

Thanks
