# Calling a MouseEvent function without a mouse event?

**URL:** <https://forum.kirupa.com/t/calling-a-mouseevent-function-without-a-mouse-event/314058>\
**Category:** Uncategorized\
**Created:** [September 17, 2010, 2:17am UTC](https://forum.kirupa.com/t/calling-a-mouseevent-function-without-a-mouse-event/314058 "2010-09-17T02:17:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nortagem](https://avatars.discourse-cdn.com/v4/letter/n/9de053/32.png) [@nortagem](https://forum.kirupa.com/u/nortagem)\
**Post date:** [September 17, 2010, 2:17am UTC](https://forum.kirupa.com/t/calling-a-mouseevent-function-without-a-mouse-event/314058/1 "2010-09-17T02:17:05Z")

</div>

Hi all,

in actionscript 2.0, one could call a mouseEvent function without actually having that event. For instance:

btn1.onRollOut = function(){  
this. gotoAndPlay(“out”);  
}

btn2.onRelease = function(){  
[FONT=Arial Black] btn1.onRollOut();[/FONT]  
}

However, I can’t seem to do the same in AS 3.0.

btn1.addEventListener(MouseEvent.ROLL\_OUT, rollOutHandler);  
btn2.addEventListener(MouseEvent.CLICK, clickHandler);

function rollOutHandler(Event:MouseEvent):void{  
Event.currentTarget.gotoAndPlay(“out”);  
}

function clickHandler(Event:MouseEvent):void{  
// [FONT=Arial Black] btn1.rollOutHandler???[/FONT]  
}

In this example, of course, rollOutHandler only does one thing,  
but this function could contain lots and lots of code, and I would not want to repeat all of it again inside the clickHandler function.

Any ideas???
