Yes, the content of the toggleButtonBar will be determined entirely by its
dataProvider.  If you want to change the content of the button
Bar, you must change its dataprovider.

 

One way to do this is to add/remove the viewstack children.

 

But this process has always seemed unnecessarily difficult, just to change
the visibility/availability or a button, so I never use a viewStack as a
dataProvider for anything that needs to be dynamically controlled.

 

Instead, I use a separate dataProvider, for the control bar, which contains
the index into the viewStack, and manipulate that dataProvider to control
the available buttons.  A click on a button uses the index in the
dataProvider to set the selectedIndex of the ViewStack.

 

Tracy

 

  _____  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Tim Hoff
Sent: Friday, March 06, 2009 2:57 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: hiding an applicationcontrolbar button

 


Hi Greg,

Have you tried removeChild()?

-TH

--- In flexcod...@yahoogro <mailto:flexcoders%40yahoogroups.com> ups.com,
Greg Morphis <gmorp...@...> wrote:
>
> I tried that in the creationComplete function and the show function.
> Neither hid the tab/button
>
> On Fri, Mar 6, 2009 at 9:16 AM, Adrian Williams
> adri...@... wrote:
> > Hi Greg,
> >
> > does this not work for you?
> >
> > if (MyModel.getInstance().currentUser.useraccess == "99")
> > {
> > aHeadlines.visible = true;
> > }
> > else
> > {
> > aHeadlines.visible = false;
> > }
> >
> >
> >
> > Greg Morphis wrote:
> >
> > I'm trying to hide or destroy a button that's showing in an
> > ApplicationControlBar.
> > Basically when the user logs into the tool their information is
> > checked and one button or another will show.
> >
> > The code currently looks like
> >
> > <mx:VBox... >
> > <mx:ApplicationControlBar ... >
> > <mx:ToggleButtonBar id="adminMenu" .... dataProvider="{adminVS}">
> > </mx:ApplicationControlBar>
> >
> > <mx:ViewStack ... id="adminVS" ... >
> > <AdminVW:AdminUser id="aUser" ... />
> > <AdminVW:AdminSecurity id="securityBox" ... />
> > <AdminVW:AdminMenu id="aMenu" ... />
> > <AdminVW:AdminNews id="aNews" ... />
> > <AdminVW:AdminTopAgentsid="aUser" ... />
> > <AdminVW:AdminHeadlines id="aHeadlines" ... />
> > ...
> >
> > What if I only wanted to show the AdminHeadlines button if when they
> > log in thier access is "99".
> > The access is stored in MyModel.getInstance().currentUser.useraccess
> >
> > I've tried using a function and setting the visiable and
> > includeInLayout to the return value, I.E.:
> > private function showHeadlines ():Boolean {
> > return (MyModel.getInstance().currentUser.useraccess == "99")
> > }
> >
> > But that's not working.. Ideas?
> >
> > Thanks!
> >
> >
> >
>



Reply via email to