Hi group..

I am creating some application where I need the menu to change
according  to the type of user that is loggin in this application.

So, based on which privileges this user has, I want to show some menu
items in the application.

I am using a simple LinkBar linked to the ViewStack component and I
need to Show/hide some Canvases to it dynamically.

for expample:


<mx:LinkBar id = "l" x="123.5" y="10" dataProvider="VS"/>
<mx:ViewStack  id="VS" x="10" y="52" width="430" height="200">

<mx:Canvas visible = "false" id="C1" label="Canvas 1" width="100%"
height="100%"/>
<mx:Canvas id="C2" label="Canvas 2" width="100%" height="100%"/>
<mx:Canvas id="C3" label="Canvas 3" width="100%" height="100%"/>

</mx:ViewStack>
        <mx:Script>
        <![CDATA[
        import mx.containers.Canvas;
        public function addCanvas():void {
                C1.visible = true;              
        }
        ]]>
        </mx:Script>
<mx:Button x="162.5" y="271" click="addCanvas();" label="Button"
width="125"/>

</mx:Application>

As you see I added in the first Canvas a visible property set to
"FALSE" so it is supposed not be "visible" on the stage.

in this case I would set it visible on runtime using the actionscript
code C1.visible = true but it does not work.

I also tried 

var c:Canvas = new Canvas();
VS.addChild(c);

and it does show a new link in the LinkBar (and flex create a new
ViewStack Canvas for it) but at this point I would not be able to add
object in that specified canvas. So I'd prefer to create the Canvas
first in the ViewStack (with its objects) and set It invisible and
than setting it visible on runtime..

any Suggestion?

Thanks so much.

Cordially

Reply via email to