tags:

views:

275

answers:

1

Hello,

I've made a custom component based on MenuBar. This is the code

<?xml version="1.0" encoding="utf-8"?>
<mx:MenuBar xmlns:mx="http://www.adobe.com/2006/mxml"
    width="100%" 
    labelField="@label">
    <mx:XMLList>
     <menuitem label="Website" />
    </mx:XMLList>
</mx:MenuBar>

The problem is that the "Website" isn't displayed.

EDIT

I found the correct syntax and it's working now

<?xml version="1.0" encoding="utf-8"?>
<mx:MenuBar xmlns:mx="http://www.adobe.com/2006/mxml"
    width="100%" 
    labelField="@label" dataProvider="{menuXmlListCollection}">
    <mx:XMLListCollection id="menuXmlListCollection">
     <mx:XMLList>
      <menuitem label="Website" />
     </mx:XMLList>
    </mx:XMLListCollection>
</mx:MenuBar>
+1  A: 

You can do this same thing with a ArrayCollection:

private var menuXmlListCollection: ArrayCollection = new ArrayCollection([ { label: "Website"}, { label: "Webmail"}, { label: "Blog"}];

flaviocarmo