# Button code

**URL:** <https://forum.kirupa.com/t/button-code/327741>\
**Category:** Uncategorized\
**Created:** [March 25, 2012, 4:55pm UTC](https://forum.kirupa.com/t/button-code/327741 "2012-03-25T16:55:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Estrada](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@Mark\_Estrada](https://forum.kirupa.com/u/Mark_Estrada)\
**Post date:** [March 25, 2012, 4:55pm UTC](https://forum.kirupa.com/t/button-code/327741/1 "2012-03-25T16:55:55Z")

</div>

Hello, I have a button called home in each of my frames that goes back to the main screen but how can I code this so I dont have to repeat the code in each of those frames with the button “home”–

//Home  
home\_btn.addEventListener(MouseEvent.CLICK, home3);  
function home3(event:MouseEvent):void{  
gotoAndStop(1);  
}
