当前位置: 代码迷 >> Web前端 >> 创设menuBar
  详细解决方案

创设menuBar

热度:225   发布时间:2012-10-28 09:54:44.0
创建menuBar
public String getItems() {
		StringBuffer item = new StringBuffer();
		item.append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
		item.append("<root>");
		item.append("<menuitem lable=\"菜单一\" data=\"top\">");
		item.append("<menuitem lable=\"A1\" data=\"A1\"/>");
		item.append("<menuitem lable=\"A2\" data=\"A2\"/>");
		item.append("</menuitem>");
		item.append("<menuitem lable=\"菜单二\" data=\"top\">");
		item.append("<menuitem lable=\"A3\" data=\"A3\"/>");
		item.append("<menuitem lable=\"A4\" data=\"A4\"/>");
		item.append("</menuitem>");
		item.append("</root>");
		return item.toString();
	}


[Bindable]
	public var menuBarCollection:XMLListCollection;
	private var menuBarXml:XMLList;
				
    private function init():void
	{
		flexutil.getItems();
	}

	protected function flexutil_resultHandler(event:ResultEvent):void
	{
		var xmlString :String = event.result as String;//返回xml字符串
		var xml :XML = new XML(xmlString);//转成xml
		var xmlList :XMLList = xml.children() as XMLList;
		menuBarCollection = new XMLListCollection(xmlList);
	}