# Trying to do event.target

**URL:** <https://forum.kirupa.com/t/trying-to-do-event-target/274175>\
**Category:** Uncategorized\
**Created:** [October 26, 2008, 3:31pm UTC](https://forum.kirupa.com/t/trying-to-do-event-target/274175 "2008-10-26T15:31:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fullofebak](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@fullofebak](https://forum.kirupa.com/u/fullofebak)\
**Post date:** [October 26, 2008, 3:31pm UTC](https://forum.kirupa.com/t/trying-to-do-event-target/274175/1 "2008-10-26T15:31:03Z")

</div>

i want to use one function that i can easily edit its contents to be used with many objects when they are clicked.

here, i first create a function that shows that i want to move the target of my click to the right. i then call this function from inside 2 mouseevents.  
i am trying to make it this way so i can keep adding lines of code to the ‘moveRight’ without needing to edit the individual targets.

Can this be done?

* * *

stop();  
function moveRight(event:MouseEvent):void  
{  
event.currentTarget.x += 66  
}  
z.addEventListener(MouseEvent.CLICK, zClick);  
function zClick(event:MouseEvent):void  
{  
moveRight();  
}  
xx.addEventListener(MouseEvent.CLICK, xClick);  
function xClick(event:MouseEvent):void  
{  
moveRight();  
}

* * *

THANKS!
