TileList设置显示数据的行间距和列间距
要想设置TileList的间距只有重写TileList的 drawHighlightIndicator、drawSelectionIndicator方法和 verticalGap、horizontalGap的get\set属性才能实现,例:
/**
* Author Dante
* Email:rubbish86630@yahoo.com.cn
* CreatedTime:2009.04.13
* Description:
* 该组件实现选中和划过theme样式,并且添加间距
* **/
package com.ckfinder.show {
import flash.display.Graphics;
import flash.display.Sprite;
import mx.controls.TileList;
import mx.controls.listClasses.IListItemRenderer;
public class MyTileList extends TileList {
[Bindable]
private var _verticalGap:Number = 0;
[Bindable]
private var _horizontalGap:Number = 0;
public function MyTileList() {
super();
}
/**
* 重写鼠标划过高亮
* @indicator:Sprite
* @x:Number
* @y:Number
* @width:Number
* @height:Number
* @color:uint
* @itemRenderer:IListItemRenderer
* return void
* **/
override protected function drawHighlightIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {
//绘图
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(color);
// g.drawEllipse(0, 0, width - _horizontalGap, height - _verticalGap); //画椭圆
g.drawRect(0, 0, width - _horizontalGap, height - _verticalGap); //画矩形
g.endFill();
indicator.x = x;
indicator.y = y;
}
/**
* 重写选中高亮
* @indicator:Sprite
* @x:Number
* @y:Number
* @width:Number
* @height:Number
* @color:uint
* @itemRenderer:IListItemRenderer
* return void
* **/
override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void {
//绘图
var g:Graphics = indicator.graphics;
g.clear();
g.beginFill(color);
// g.drawEllipse(0, 0, width - _horizontalGap, height - _verticalGap); //画椭圆
g.drawRect(0, 0, width - _horizontalGap, height - _verticalGap); //画矩形
g.endFill();
indicator.x = x;
indicator.y = y;
}
//=============================
// set and get
//=============================
public function set verticalGap(value:Number):void {
_verticalGap = value;
}
public function get verticalGap():Number {
return _verticalGap;
}
public function set horizontalGap(value:Number):void {
_horizontalGap = value;
}
public function get horizontalGap():Number {
return _horizontalGap;
}
}
}
分享到:
相关推荐
使用过TileList的朋友可能知道,该组件没有Item与Item之间的间距设置。而且theme也没有办法象linkbar那样设置样式corner-radius改变形状。
主要使用TileList控件,实现相册的功能。包括相册的翻页,以及点选相册时,图片的特效放大浏览、切换等等功能。
很好的解决了flex的tilelist中的checkbox 选中后,下拉滚动条乱选问题。同时解决了获取tilelist里面的数据问题。很不错的
总结cocos2d-x中滑动控件TileList的用法
这个例子展示了如何利用Flex的TileList控件,Image控件和PopUpManager类来创建一个简单的图片展示(相册)。
3.7 节为容器指定行和列的约束 3.8 节使用约束条件为文本创建排版流程(Layout Flows) 3.9 节在容器内控制滚动和溢出 3.10 节控制Box 组件的布局 3.11 节使用容器初始化 3.12 节创建TitleWindow 3.13 节通过LinkBar ...
a set of components with angularjs, which includes Datagrid,tree,dialog,progress,tilelist,tabset,dividedbox,imageview and so on. 参照了UI Bootstrap等组件的写法,主要对指令进行了自己的封装,我们希望...
Flex问题解决大全, 可学到不少技巧, 仅限科学研究用.
WebUI4Angular是基于angularjs实现的一套UI组件,主要包括:datagrid,tree,dialog,progress,tilelist,tabset,dividedbox,imageview等等。组件需要使用angularjs1.3以上版本,其中拍照组件cameraScanner另需安装flash...
设置参数和属性 . . . . . . . . . . . . . . . . . . . . . . . . . . 17 库 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 调整组件大小 . . . . . . . . . . . . . . . . . . . . . . . ....
TileList、Tree、VSlider VideoDisplay 7、容器控件(可包含控件及容器控件) Canvas、ControlBar、Form、FormHeading、Grid、HBox、HDividedBox ModuleLoader、Panel、Spacer、Tile、TileWindow、VBox、...