It will not be part of the view stack at all unless you want the user
to be able to access it. Essentially until you add it it doesn't
exist. When you do add the view with addChild() a button will be
created automatically and the view will become accessible you
shouldn't have to refresh anything. If the user has access to the view
when they log on add it and it should appear if not it won't be there
at all.

If thats not the functionality your looking for then a different
approach is needed. Something similar to the following may be more
appropriate for your needs. 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" xmlns:views="views.*">
<mx:Script>
<![CDATA[
[Bindable]
private var HasAccess:Boolean = false;
]]>
</mx:Script>    
<mx:ButtonBar id="myBar" dataProvider="{viewstack1}"/>
<mx:ViewStack x="10" y="30" id="viewstack1" width="200" height="200">
<views:viewone/>
<views:viewtwo id="viewtwo" show="HasAccess ? viewtwo.visible = true :
viewtwo.visible = false"/>
</mx:ViewStack>
<mx:Button label="{this.HasAccess ? 'Access' : 'No Access'}" x="10"
y="238" click="HasAccess ? HasAccess = false : HasAccess = true;"/>
</mx:Application>


Reply via email to