I have it working now thanks for all your assistance.
On Thu, Aug 13, 2009 at 5:44 PM, jaywood58 <[email protected]> wrote:
> An easy way might be to use different viewstates (e.g., a base state
> without the restricted tab, and a derived state that includes the restricted
> tab), then simply set the appropriate viewstate based on user permissions.
> Similar to your init() code, it might look something like:
>
> if (Permissions.hasPermission("restrictedTab")
> {
> currentState = "stateWithRestrictedTab";
>
> Good luck!
>
> --- In [email protected], Wesley Acheson <wesley.ache...@...>
> wrote:
> >
> > Hi I've an application already mostly written.
> >
> > *Background*:
> >
> > This application uses several custom components that extend or contain
> > TabNavigators.
> >
> > A requrirement which I've missed is that if the user doesn't have
> permission
> > to view a tab then the tab doesn't appear in the tab navigators.
> >
> > However tabs still appear even if the child elements they refer to are
> > invisible.
> >
> > So I guess that I need to do something like this in my MXML files.
> >
> >
> > <mx:TabNavigator xmlns:mx="http://www.adobe.com/2006/mxml"
> > xmlns:component="com.example.test.*" CreationComplete="init()">
> > ...
> > //Normal stuff in here
> > ...
> > public var tab1:CustomComponent1;
> > public var tab2:CustomComponent2;
> > //etc
> > ...
> >
> > private function init():void
> > {
> > if (Permissions.hasPermission("viewTab1")
> > {
> > tab1 = new CustomComponent1;
> > ...
> > // Set the properties that are normally specified in MXML
> > // Add event listeners for all the events normally specified in mxml.
> > // e.g. tab1.addEventListener(SaveEvent.SAVE, handleSave);
> > // Do any bindings that are normally associated with the MXML
> > }
> > }
> >
> > ...
> > </mx:TabNavigator>
> >
> > *Questions:*
> >
> > 1. How do I set up the bindings? I have seen
> >
> http://livedocs.adobe.com/flex/3/html/help.html?content=databinding_7.htmlhowever
> > this leaves me worried that binding will occur differently. I'm
> > particually worried that I'll get binding events occuring before the
> > component is initialised which won't (As is normal in mxml) be
> swallowed by
> > the framework. I don't even know where I'd put a try block for these
> errors.
> > 2. Doing things in this way means that tabs the user has permission
> for
> > but hasn't clicked on don't apply for deferred instanceiation. Is
> there any
> > way to get this back. (Normally the tab navigator only instances its
> > children when the appropiate tab is selected).
> > 3. Creating the child after CreationComplete doesn't feel right to me.
> I
> > guess I could overwrite create children in the above example but not
> when my
> > MXML file contains a TabNavigator rather than is a TabNavigator which
> is
> > also a situation elsewhere in the application. Is there a better way
> arround
> > this? Creating a ChildDiscriptor object. Does doing things in this
> way mean
> > a blank component appears then its contents appear?
> >
> > Thanks in Advance,
> > Wes
> >
>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>