标签:
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script> <![CDATA[ private var buttonBarXML:XML = describeType(ButtonBar); protected function labelFun(item:Object):String { //trace(buttonBarXML.factory.toString());
var cat:String = item.label.toUpperCase(); var len:uint = buttonBarXML.factory.child(item.data).length(); return item.label + " (" + len + ")"; } ]]> </fx:Script> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <s:ArrayList id="arr"> <fx:Array> <fx:Object label="Accessors" data="accessor"/> <fx:Object label="Methods" data="method"/> <fx:Object label="ImplementsInterface" data="implementsInterface"/> <fx:Object label="Variable" data="variable"/> </fx:Array> </s:ArrayList> </fx:Declarations> <s:ButtonBar id="buttonBar" dataProvider="{arr}" labelFunction="labelFun" /> </s:Application>
[Flex] ButtonBar系列——labelFunction用户提供的函数,在每个项目上运行以确定其标签
标签:
原文地址:http://www.cnblogs.com/frost-yen/p/4881915.html