[flexcoders] Re: Hiding Viewstack elements in a toggleButtonBar dataprovider

2007-04-27 Thread gotjosh819i
Well not sure how I would remove it with this current setup:

mx:ApplicationControlBar id=viewAppControllBar 
width=100% height=31 styleName=viewControlBar
mx:Canvas width=100% height=100%
mx:Image id=synergyLogo 
source={viewAppControllBar.getStyle('synergyTextLogo')}  left=0/
mx:ToggleButtonBar id=mainToggleBar
 
height=100%
dataProvider={viewController}
styleName=viewButtonBar left=231/

/mx:Canvas  
/mx:ApplicationControlBar
 
mx:ApplicationControlBar  id=syncLoginBar 
width=100% height=25 styleName=loginBar paddingLeft=0
mx:Canvas width=100% height=100%  

mx:Label id=welcomeName text=User Logged 
In As: {model.user.user_fname + ' ' + model.user.user_lname} top=2 
styleName=normalTenBold color=#ff  width=230 x=3/

mx:LinkButton label=Logout top=2 
id=btn_logout textAlign=right right=2/
/mx:Canvas
/mx:ApplicationControlBar 


!-- viewStack Controller :: viewController -- 

mx:ViewStack id=viewController selectedIndex=0 
width=100% height=600 
view:Home id=homeView 
creationCompleteEffect=fadeIn showEffect=fadeIn 
hideEffect=fadeOut/ 

mx:Canvas label=Portfolio Center 
showEffect=fadeIn hideEffect=fadeOut/mx:Canvas   

view:Contact id=contactView  
showEffect=fadeIn hideEffect=fadeOut 

contactListDP={model.processContactsDP} 
contactCategoriesDP={model.contactCategoriesDP}/

view:Resources id=trainingHelpView 
showEffect=fadeIn hideEffect=fadeOut/

view:Community id=communityView 
showEffect=fadeIn hideEffect=fadeOut /

view:RequestAccess id=requestAccessView  
showEffect=fadeIn hideEffect=fadeOut

contactListDP={model.processContactsDP}/

view:Administration id=adminView  
showEffect=fadeIn hideEffect=fadeOut enabled=false/
/mx:ViewStack


I am hoping there is a method or build some logic that will remove 
the admin view from the viewstack if the role permissions dont match 
the admin view.


--- In flexcoders@yahoogroups.com, Manish Jethani 
[EMAIL PROTECTED] wrote:

 The only thing I can suggest is that you remove the admin view from
 the view stack. *Or* you can also disable it (and the button will be
 disabled).
 
 On 4/27/07, gotjosh819i [EMAIL PROTECTED] wrote:
  Good morning all,
 
  I am working on a project that requires some level permissions.  
I have
  a main viewstack that I call viewController and theres some 
elements in
  there.
 
  One of them in a Admin view that I would like to hide if the user
  doesnt have those permissions.
 
  I am struggling a little bit on how to do this, the visible 
property
  doesnt remove the viewstack element from the dataprovider when 
its set
  to false.
 
  Any suggestions that may lead me down the right path is 
appreciated.
 
  Thanks,
 
  Josh
 
 
 
  --
  Flexcoders Mailing List
  FAQ: 
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
  Yahoo! Groups Links
 
 
 
 





Re: [flexcoders] Re: Hiding Viewstack elements in a toggleButtonBar dataprovider

2007-04-27 Thread Manish Jethani
On 4/28/07, gotjosh819i [EMAIL PROTECTED] wrote:
 Well not sure how I would remove it with this current setup:

 !-- viewStack Controller :: viewController --

 mx:ViewStack id=viewController selectedIndex=0
 width=100% height=600 

 view:Administration id=adminView
 showEffect=fadeIn hideEffect=fadeOut enabled=false/
 /mx:ViewStack

If the role permissions do not match, you can do this:

  viewController.removeChild(adminView);

That'll remove the admin view from the view stack, while still keeping
it around in memory (you have a reference to it). You can add it back
later, or whatever.