<?xml version="1.0"?>
<!-- Simple example to demonstrate the MenuBar control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initCollections();" >
<mx:Script>
<![CDATA[
import mx.events.MenuEvent;
import mx.controls.Alert;
import mx.collections.*;
import mx.controls.Menu;
[Bindable]
public var menuBarCollection:XMLListCollection;
private var menubarXML:XMLList =
<>
<menuitem label="Home" data="top" type="check"/>
<menuitem label="ABC" data="top">
<menuitem label="ABC" data="sdfg"/>
</menuitem>
<menuitem label="ABC" data="top" />
<menuitem label="ABC" data="top" />
<menuitem label="ABC" data="top">
<menuitem label="ABC" data="sdfg"/>
</menuitem>
<menuitem label="ABC" data="top"/>
<menuitem label="ABC" data="top" >
<menuitem label="ABC" data="dsg"/>
<menuitem label="ABC" data="dsfg"/>
<menuitem label="ABC" data="sgd"/>
</menuitem>
<menuitem label="Logout" data="top"/>
</>;
// Event handler to initialize the MenuBar control.
private function initCollections():void {
menuBarCollection = new XMLListCollection(menubarXML);
}
// Event handler for the MenuBar control's itemClick event.
private function menuHandler(event:MenuEvent):void {
// Don't open the Alert for a menu bar item that
// opens a popup submenu.
if (event.it...@data != "top") {
Alert.show("Label: " + event.it...@label + "\n" +
"Data: " + event.it...@data, "Clicked menu item");
}else{
if(event.it...@label=="Home"){
Alert.show("Label: " + event.it...@label + "\n" +
"Data: " + event.it...@data, "Clicked menu item");
}
}
}
private function menubarclick_PP(event:MouseEvent):void {
Alert.show(myMenuBar.selectedIndex.toString());
}
]]>
</mx:Script>
<mx:Panel title="MenuBar Control Example" height="75%" width="75%"
paddingTop="10" paddingLeft="10">
<mx:Label width="100%" color="blue"
text="Select a menu item."/>
<mx:MenuBar id="myMenuBar" labelField="@label"
itemClick="menuHandler(event);" click="menubarclick_PP(event)"
dataProvider="{menuBarCollection}" />
</mx:Panel>
</mx:Application>
I need a help in this place
private function menubarclick_PP(event:MouseEvent):void {
Alert.show(myMenuBar.selectedIndex.toString());
}
Alert.show(myMenuBar.selectedIndex.toString());
instead of alerting index value i want to alert the data value of the
corresponding item.
Help me very urgent...
Regards,
Dhileepen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---