Hi I want to create a flex web page. Basically I have some menubaritems at the top and when I click at one of the dropdowns from the menubar, the component would change to a page with different content.
How do I go about this?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sounds to me like the exact component you’re after is the
TabNavigator(Adobe docs).It’s fairly simple to use. Each child of the the
TabNavigatorcomponent represents a tab page of content (note that children must be containers such asCanvasorVBox), and thelabelproperty of the child is used to represent the label on the tab itself.A very simple web site using tabs might look something like:
You can stack as many child container components within the
TabNavigatoras you like, and their contents will (by default) only be loaded when you select the relevant tab.If you can be a little more specific about what you’re trying to build, there’s probably a few more tricks for you out there too. Hopefully this gives you a start though.
EDIT: Okay, if you’re using dropdown menus instead, it’s the same concept but a little more manual labour is involved.
The
TabNavigatorcomponent uses aViewStackcomponent (Adobe docs), which is basically a stack of content pages where only one is shown at a time (determined by the stack’sselectedIndexproperty), with aTabBarcomponent to control the selected index. What you want to do is still use that same ViewStack to hold all your pages, but you want a dropdown menu item selection to change the selectedIndex for you.A
MenuBarcomponent (Adobe docs) provides the dropdown items, generated from an XMLListCollection data provider. To handle item selections, set anitemClickevent handler to the MenuBar, and set the ViewStack’s selectedIndex property based on which menu item was selected.Something like this should give you a start, and hopefully the comments help explain it. From there you can add pages, MenuBar items, etc.