# Need tips for optimizing my menu class

**URL:** <https://forum.kirupa.com/t/need-tips-for-optimizing-my-menu-class/330700>\
**Category:** flash\
**Created:** [March 2, 2013, 12:32pm UTC](https://forum.kirupa.com/t/need-tips-for-optimizing-my-menu-class/330700 "2013-03-02T12:32:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Flopsie](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@Mr\_Flopsie](https://forum.kirupa.com/u/Mr_Flopsie)\
**Post date:** [March 2, 2013, 12:32pm UTC](https://forum.kirupa.com/t/need-tips-for-optimizing-my-menu-class/330700/1 "2013-03-02T12:32:57Z")

</div>

Hello  
I’m making a flash game. First I thought my code for the menu was good. But actually it’s a real mess and when you take a break for a couple of weeks and then come back the code is really confusing.  
I have a main empty button class which I add for each button. But I have trouble to maintain control on when they have to animate(slide in the screen or slide out) and also use a crappy timer so they won’t overlap each other. At the moment it works. But now I want to add a new button that will bring up an achievements screen. And I realize that my current code is not good.  
Ok, I know that explanation isn’t really good either.

Do you guys have some rules/tips that you use when creating a menu? For the people that want to see my class. Should I just post it here with code tags or link the file?

You can see the menu in action here: [http://mmo2.mrflopsie.be/?page\_id=148](http://mmo2.mrflopsie.be/?page_id=148)

Thanks
