I am working on a game in flex, and I am trying to figure out how to create menus in the game. I am was thinking it would be easy just to add and remove a child for the menu, but then it would be a pain to make interactive开发者_开发技巧. I figure there must be some way to do it, so I am asking here.
I am trying to do both a pop up menu and an always on screen menu, like a bottom menu bar, so if anyone has any ideas please let me know. I am completely new to flash and flex and don't really know where to start past making the actual game. Thanks
WWaldo
In terms of making a menu with different appearances based off of the state of something, check out the built in state management :
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf63611-7ffa.html
This lets you define what children appear in which state of the menu, then you just set the currentState : currentState='soundMenu'
Have you looked at the Flex MenuBar class?
More documentation on it here.
If you need something spark related, check out the ButtonBar and see about extending that.
Beyond that, I'm unclear exactly what you want. Adding and removing children to any given Flex UIComponent is pretty easy. I don't know why that would make it hard for things to be interactive.
精彩评论