# AS3 function call from multiple locations

**URL:** <https://forum.kirupa.com/t/as3-function-call-from-multiple-locations/249513>\
**Category:** Uncategorized\
**Created:** [January 19, 2008, 3:38pm UTC](https://forum.kirupa.com/t/as3-function-call-from-multiple-locations/249513 "2008-01-19T15:38:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![worthington747](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@worthington747](https://forum.kirupa.com/u/worthington747)\
**Post date:** [January 19, 2008, 3:38pm UTC](https://forum.kirupa.com/t/as3-function-call-from-multiple-locations/249513/1 "2008-01-19T15:38:07Z")

</div>

[FONT=Calibri][SIZE=3]I am new to AS3 and have noticed that calling a function from a mouse event requires just that event as a parameter in the function declaration[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]function doSomething ([COLOR=#0070c0]evt:MouseEvent[/COLOR]):void{}[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]I would like to call the same function from different places like so[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]function doSomething ():void{[/SIZE][/FONT]  
[SIZE=3][FONT=Calibri] trace(“doSomething”) [/FONT][/SIZE]  
[FONT=Calibri][SIZE=3]} [/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]box.addEventListener(MouseEvent.CLICK,doSomething);[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]doSomething();[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3] //[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]Without getting the output[/SIZE][/FONT]  
[FONT=Calibri][SIZE=3]ArgumentError: Error #1063: Argument count mismatch on doSomething\_fla::MainTimeline/doSomething(). Expected 0, got 1.[/SIZE][/FONT]  
When the box is clicked.

Thanks in advanced.
