Advertisement
Guest User

Tut 3 - Menus

a guest
Dec 18th, 2014
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. menuLoaders.visible = false;
  2. menuLoaders.btnQuest.addEventListener(MouseEvent.CLICK, btnQuest_onClick);
  3. /*Notice how the event listener is now being applied to 'menuLoaders.btnQuest' as btnQuest is now being held on the menuLoaders symbol.*/
  4. function btnQuest_onClick(e:MouseEvent):void
  5. {
  6. Game.world.showQuests(menuLoaders.txtQuest.text, "q");
  7. //Same goes for the TextInput called txtQuest
  8. }
  9. btnLoaders.addEventListener(MouseEvent.CLICK, btnLoaders_onClick);
  10. //This button will now be used to open the Loaders menu
  11. function btnLoaders_onClick(e:MouseEvent):void
  12. {
  13. menuLoaders.visible = !menuLoaders.visible;
  14. //This toggles the visibility of the menu. This method is much cleaner than using if statements.
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement