I'm working in Flex 4.1, and I have a viewstack and tabbar as my main navigation. A user logs into the application and should then only be able to see what tabs are available to his user level.
I am trying to stick with MXML as much as possible, since it works well with the framework. But I'm goin numb thinking about this. What are the common practices for doing this?
FYI: the user level is slightly to complex for states. There are lots of options, way to many to comfortably do w/ states and state groups.
Chimp is a pretty cool library for those interested. It's a little old and there doesn't seem to be much motivation to expand it past UIComponents. So for my purposes it wont do.
Again, what do you do for setting up these systems?
UPDATE: I had to compromise, but it actually worked out pretty well in the end. Instead of destructively laying on permissions (having everything available at first and removing the elements thereafter), the system now works constructively. Here's a sample:
[Bindable]
public var managePage:ManagePage;
[Bindable]
public var reportPage:ReportPage;
...
switch(permission)
{
case "create":
navigatorContent.label = "Manage";
navigatorContent.addElement(managePage);
viewStack.addElementAt(navigatorContent,1);
break;
case "read":
navigatorContent.label = "Report";
navigatorContent.addElement(reportPage);
viewStack.addElementAt(navigatorContent,2);
break;
}
Obviously this is only for adding elements, but removing them is just as easy. This solution leaves me with everything I was looking for, so I'm happy.