Hi guys!

Here is an working example (is the best way I found until now)

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
    <![CDATA[
        import mx.events.MenuEvent;
        import mx.controls.Alert;
        import mx.collections.* ;
       
        private var menubarXML:XMLList =
            <>
                <menuitem label="Option 1" data="">                    <menuitem label="Sub1" data=""
                    <menuitem label="Sub2" data="">                    <menuitem label="Sub3" data="">                </menuitem>
                <menuitem label="Option 2" data=""
                <menuitem label="Option 3" data="">            </>;
           
        [Bindable]
        public var menuBarCollection:XMLListCollection = new XMLListCollection(menubarXML);

        private function menuHandler(event:MenuEvent):void  {
            Alert.show("Label: " + [EMAIL PROTECTED] + "\n" +
                "Data: " + [EMAIL PROTECTED], "Clicked submenu item");
        }
       
        private function menuHandlerTopLevel(oEvent:MouseEvent):void {
            var topLevel:XML = new XML(oEvent.target.dataProvider);
            if(topLevel.children().length() == 0 ){
                Alert.show("Label: " + [EMAIL PROTECTED] + "\n" +
                "Data: " + [EMAIL PROTECTED], "Clicked menu item");               
            }
        }
    ]]>
</mx:Script>
<mx:MenuBar labelField="@label" click="menuHandlerTopLevel(event)" itemClick="menuHandler(event)"
                dataProvider="{menuBarCollection}" />
</mx:Application>


Regards

Rogerio


On 10/10/06, shemeshkale <[EMAIL PROTECTED] > wrote:

anyone? someone?

--- In flexcoders@yahoogroups.com, "shemeshkale" <[EMAIL PROTECTED]> wrote:
>
> i have a MenuBar that have one root with no childs.
> how do i detect a click on the root?
> it seems that the itemClick only catch clicks on the menu itself, it
> doesn't catch the clicks on the root.
>


__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to