Flex的tree自动显示横向滚动条的方法
Flex #tree #滚动条2014-04-10 10:12
上代码。
package com.anydata.consumer.components { import flash.events.Event; import mx.controls.Tree; import mx.core.ScrollPolicy; import mx.core.mx_internal; /** * 自动显示横向滚动条 */ public class AutoSizeTree extends Tree { public function AutoSizeTree() { super(); horizontalScrollPolicy = ScrollPolicy.AUTO; } override public function get maxHorizontalScrollPosition() : Number { if (isNaN(mx_internal: :_maxHorizontalScrollPosition)) return 0; return mx_internal: :_maxHorizontalScrollPosition; } override public function set maxHorizontalScrollPosition(value: Number) : void { mx_internal: :_maxHorizontalScrollPosition = value; dispatchEvent(new Event("maxHorizontalScrollPositionChanged")); scrollAreaChanged = true; invalidateDisplayList(); } override protected function updateDisplayList(unscaledWidth: Number, unscaledHeight: Number) : void { var diffWidth: Number = measureWidthOfItems(0, 0) - (unscaledWidth - viewMetrics.left - viewMetrics.right); var indentation: Number = getStyle("indentation"); if (diffWidth <= 0) maxHorizontalScrollPosition = NaN; else maxHorizontalScrollPosition = diffWidth + indentation; super.updateDisplayList(unscaledWidth, unscaledHeight); } } }
相关文章
- Flex自定义右键菜单的代码 2014/04/10
- flex4 Panel设置透明度效果的代码 2014/04/10
- flex4 Panel去掉标题的代码 2014/04/10
- Flex的Label控件竖排显示文字的方法 2014/04/10
- Flex4.5中CSS选择器介绍 2014/04/10
- Flex取消事件的默认行为发方法 2014/04/10
- flex分页打印操作实现代码 2014/04/10
- Flex动态生成可编辑的DataGrid 2014/04/10
- flash 报错捕获的方法 2014/04/10
- Flex压缩图片时exif信息丢失问题解决方法 2014/04/10