can any one help me regarding the events related to menubar sub items, here is some code iam working with
<menuitem label="Home"/>
<menuitem label="AboutUs"/>
<menuitem label="CoursesOffered">
<menuitem label="UG">
<menuitem label="CSE"/>
<menuitem label="EEE"/>
<menuitem label="ECE"/>
<menuitem label="IT"/>
<menuitem label="MECH"/>
<menuitem label="CIVIL"/>
</menuitem>
<menuitem label="PG">
<menuitem label="CSE"/>
<menuitem label="ECE"/>
<menuitem label="MCA"/>
</menuitem>
</menuitem>
<menuitem label="Departments">
<menuitem label="CSE" >
<menuitem label="HOD" />
<menuitem label="Staff" />
<menuitem label="DeparmentGallary"/>
</menuitem>
<menuitem label="ECE">
<menuitem label="HOD"/>
<menuitem label="Staff" />
<menuitem label="DeparmentGallary"/>
</menuitem>
<menuitem label="EEE">
<menuitem label="HOD"/>
<menuitem label="Staff" />
<menuitem label="DeparmentGallary" />
</menuitem>
<menuitem label="IT">
<menuitem label="HOD"/>
<开发者_开发百科;menuitem label="Staff"/>
<menuitem label="DeparmentGallary"/>
</menuitem>
<menuitem label="MECH">
<menuitem label="HOD"/>
<menuitem label="Staff"/>
<menuitem label="DeparmentGallary"/>
</menuitem>
<menuitem label="CIVIL">
<menuitem label="HOD"/>
<menuitem label="Staff"/>
<menuitem label="DeparmentGallary"/>
</menuitem>
<menuitem label="SH"/>
</menuitem>
<menuitem label="ExaminationSection"/>
<menuitem label="TrainingAndPlacement"/>
<menuitem label="Alumni"/>
<menuitem label="ContactUs"/>
i want to handle events wen particular subitem is clicked
for example ,if submnu item hod of cse is clicked it should go to the particular mxml page ,and if hod of ece is clicked it shold goto other page how do i differentiate each page of particular deparment how do select that particulasr item of that particular submenu itm if any one knows plz help meeeeeeee...................?????
The easiest way is to add an id
attribute to any menu item that is a leaf and store those id values in static constant fields in the corresponding class.
public static const None:Number = 0;
public static const CSE_HOD:Number = 12;
public static const CSE_STAFF:Number = 13;
//and so on
in the dataProvider
<menuitem label="CSE" id="0">
<menuitem label="HOD" id="12"/>
<menuitem label="Staff" id="13"/>
</menuitem>
<menuitem label="ECE" id="0">
and the itemClick
event handler of the MenuBar
switch(Number(menuEvent.item.@id))
{
case CSE_HOD:
//deal with cse hod here
break;
case CSE_STAFF:
//deal with cse staff here
break;
//and so on
default:break; //switch defaults for non leaf menu items like CSE etc
}
精彩评论