Flex: CheckBox Tree

Categories: Flex; Tagged with: ; @ March 7th, 2010 20:14

07/2011 Update: 已更新下载链接.  无法访问box.net的朋友可使用dbank的链接进行下载.

效果与功能:

image

1. 简单配置数据源即可实现多层显示
2. 可设定初始选定的项目或目录
3. 获得选定的项目

(more…)

Flex: 汉字转拼音

Categories: Flex; Tagged with: ; @ March 7th, 2010 16:25

Flex中将汉字转换为拼音:

image

使用方法:

			var han2pinyin:HanZi2PinYin = new HanZi2PinYin();
			Alert.show(han2pinyin.toPinyin("汉字"));

HanZi2PinYin类下载:

Box: http://www.box.net/shared/t8ucn0bz4i (已被墙)

DBank下载: http://dl.dbank.com/c07voeu804

代码非本人原创, 出处:http://www.ppzhao.net/index.php/archives/175

Flex: PieChart LabelFunction

Categories: Flex; Tagged with: ; @ March 4th, 2010 14:54

使用labelFunction 直接显示PieChart的信息, 如下代码定义一个PieChart:

		
					
						
					
				
				

其labelFunction:

		/** 过期分布PieChart的LabelFunction.  */
		protected static function labelFunForChartExpDEtail(item:Object, field:String, index:Number, percentValue:Number):String {
			var percentString:String = percentValue.toString().substr(0, 5);
			return UserQualStatistics.getTypeLabel(item.type) + ":" + "\n" + RM.getString(BUNDLE_DASHBOARD, "info.total") + ":" + item.total + "(" + percentString + "%)";
		}

效果:

 

image

Flex:Chart 设置DataTipFunction

Categories: Flex; Tagged with: ; @ March 4th, 2010 14:08

某BarChart: showDataTips="true" dataTipFunction="dataTipFunForQualExpSummary"

tipFunction:

		/** 资格过期摘要图表的dataTipFunction. */
		protected  function dataTipFunForQualExpSummary(hd:HitData):String {
			var curObj:Object = hd.item;
			var curSeries:BarSeries = BarSeries(hd.chartItem.element); // 获得当前的BarSeries
			return curObj.qual + "-" + curSeries.displayName + "\n" + uqStatistics.getUQAs(curSeries.xField, curObj.qualObj).length + RM.getString(BUNDLE_DASHBOARD, "label.piece");
		}

效果:

image

Flex: DataGrid使用ListEvent.ITEM_DOUBLE_CLICK监听双击事件

Categories: Flex; Tagged with: ; @ January 31st, 2010 16:48

之前没怎么注意, 一直用MouseEvent.DOUBLE_CLICK来监听DataGrid的双击事件. 但这样会造成即使在空行双击也会激发响应.

		datagridClasses.doubleClickEnabled = true;
		datagridClasses.addEventListener(MouseEvent.DOUBLE_CLICK, onDGDoubleClicked);

正确方法应该使用ListEvent.ITEM_DOUBLE_CLICK监听项目双击事件.

		datagridClasses.addEventListener(ListEvent.ITEM_DOUBLE_CLICK, onDGDoubleClicked);

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.