3 Replies Latest reply on Jul 15, 2010 7:21 AM by EvolvedDSM

    MenuBar: How to add items to arrayCollection via actionscript?

    EvolvedDSM Level 2

      I want to use a menuBar for my app's menu.  I have a list of menu items that I want to set up for the menuBar, but i need to set them up using actionscript so I can use conditionals for which menu items to add depending on the user's access level.


      Here's the generic view of what I want



           mBarAC.addItem({label:"Label 1",data:"Label1"});


           if(userObj.access == 'admin'){

                mBarAC.addItem({label:"Label 3",data:"Label3"});




      <mx:MenuBar id="mBar" dataProvider="{mBarAC}" labelField="@label"/>


      But this results in [object Object] for every menu item.  So, how do I fix this so it shows the labels I want?