Add an event listener for the menubar rather than each item then check the label of the item that was clicked in the event.
See http://livedocs.adobe.com/flex/3/html/help.html?content=menucontrols_6.html for an example. --- In flexcoders@yahoogroups.com, Gustavo Duenas <gduenas@...> wrote: > > Hi I have this code, for a title bar, so far I can add behaviours to > the main buttoms but I come with the ideo to add new > sub-buttoms and I'm lost how can I put eventlisteners to them? > > here is the code of my buttom bar > > <mx:MenuBar width="1079.697" height="40.151516" id="mBar" > labelField="@label" creationComplete="init()" fontSize="14" > fillAlphas="[0.26, 0.26, 0.26, 0.26]" fontWeight="bold" > cornerRadius="6" color="#071243" fontFamily="Arial" > verticalCenter="-4" left="9.05"> > <mx:dataProvider> > <mx:XMLListCollection> > <mx:XMLList xmlns=""> > <item label="Peticin de Oracin"/> > <item label="Peticin de Visita"/> > <item label="Contctenos"/> > <item label="Publicaciones"> > <item label="La Biblia Antiguo > Testamento"/> > <item label="La Biblia Nuevo > Testamento"/> > <item label="Concordancia Temtica de > la Biblia"/> > <item label="Doctrina Cristiana"/> > </item> > <item label="Iglesia FLS Blog"/> > <item label="Donaciones"/> > </mx:XMLList> > </mx:XMLListCollection> > </mx:dataProvider> > > > here is the code of the CDATA script. > > protected function init():void{ > > var mbiBlog:MenuBarItem= mBar.menuBarItems[4] > as MenuBarItem; > mbiBlog.addEventListener(MouseEvent.CLICK, > openWindowBlog); > > } > > the buttoms I'd like to know how can I put the eventListeners are > <item label="La Biblia Antiguo Testamento"/> > <item label="La Biblia Nuevo > Testamento"/> > <item label="Concordancia Temtica de > la Biblia"/> > <item label="Doctrina Cristiana"/> > > Some help will be appreciated. > > Gustavo >