flex tree自动显示横向滚动条实现代码_Flex教程-查字典教程网
flex tree自动显示横向滚动条实现代码
flex tree自动显示横向滚动条实现代码
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:packagecom.anydata.consumer.components{importflash.events.Eve...

复制代码 代码如下:

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学习
    热门Flex学习
    编程开发子分类