fl.controls.dataGridClasses
public class DataGridCellEditor
继承DataGridCellEditor Inheritance TextInput Inheritance UIComponent Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object
实现 ICellRenderer

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

DataGridCellEditor 类定义一些属性和方法,DataGrid 使用它们来处理和显示网格中每一行的自定义单元格内容。 自定义单元格可以包含文本、预先构建的组件(如 CheckBox)或您创建的任何类。

查看示例

另请参见

fl.controls.listClasses.ICellRenderer



公共 属性
 属性定义方
 InheritedaccessibilityProperties : AccessibilityProperties
此显示对象的当前辅助功能选项。
DisplayObject
 Inheritedalpha : Number
指示指定对象的 Alpha 透明度值。
DisplayObject
 InheritedalwaysShowSelection : Boolean
获取或设置一个布尔值,指示当文本字段不具有焦点时选定内容的显示方式。
TextInput
 InheritedblendMode : String
BlendMode 类中的一个值,用于指定要使用的混合模式。
DisplayObject
 InheritedbuttonMode : Boolean
指定此 sprite 的按钮模式。
Sprite
 InheritedcacheAsBitmap : Boolean
如果设置为 true,则 Flash Player 将缓存显示对象的内部位图表示形式。
DisplayObject
 InheritedcondenseWhite : Boolean
获取或设置一个布尔值,该值指示是否从包含 HTML 文本的 TextInput 组件中删除额外空白。
TextInput
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
 InheritedcontextMenu : ContextMenu
指定与此对象相关联的上下文菜单。
InteractiveObject
  data : Object
获取或设置一个 Object,该 Object 表示与组件关联的数据。
DataGridCellEditor
 InheriteddisplayAsPassword : Boolean
获取或设置一个布尔值,该值指示当前创建的 TextInput 组件实例用于包含密码还是文本。
TextInput
 InheriteddoubleClickEnabled : Boolean
指定此对象是否接收 doubleClick 事件。
InteractiveObject
 InheriteddropTarget : DisplayObject
[read-only] 指定拖动 sprite 时经过的显示对象,或放置 sprite 的显示对象。
Sprite
 Inheritededitable : Boolean
获取或设置一个布尔值,指示用户能否编辑文本字段。
TextInput
 Inheritedenabled : Boolean
获取或设置一个值,该值指示组件是否可以接受用户交互。
TextInput
 Inheritedfilters : Array
包含当前与显示对象关联的每个滤镜对象的索引数组。
DisplayObject
 InheritedfocusEnabled : Boolean
获取或设置一个布尔值,该值指示组件是否可以在用户单击它后获得焦点。
UIComponent
 InheritedfocusManager : IFocusManager
获取或设置为此组件及其同级组件控制焦点的 FocusManager。
UIComponent
 InheritedfocusRect : Object
指定此对象是否显示焦点矩形。
InteractiveObject
 Inheritedgraphics : Graphics
[read-only] 指定属于此 sprite 的 Graphics 对象,在此 sprite 中可执行矢量绘画命令。
Sprite
 Inheritedheight : Number
获取或设置组件的高度,以像素为单位。
UIComponent
 InheritedhitArea : Sprite
指定一个 sprite 用作另一个 sprite 的点击区域。
Sprite
 InheritedhorizontalScrollPosition : int
获取或设置水平滚动条的滑块位置。
TextInput
 InheritedhtmlText : String
包含文本字段所含字符串的 HTML 表示形式。
TextInput
 InheritedimeMode : String
获取或设置输入法编辑器 (IME) 的模式。
TextInput
 Inheritedlength : int
[read-only] 获取 TextInput 组件中的字符数。
TextInput
  listData : ListData
获取或设置应用到单元格的列表属性,例如 index 和 selected 值。
DataGridCellEditor
 InheritedloaderInfo : LoaderInfo
[read-only] 返回一个 LoaderInfo 对象,其中包含加载此显示对象所属的文件的相关信息。
DisplayObject
 Inheritedmask : DisplayObject
调用显示对象被指定的 mask 对象遮罩。
DisplayObject
 InheritedmaxChars : int
获取或设置用户可以在文本字段中输入的最大字符数。
TextInput
 InheritedmaxHorizontalScrollPosition : int
[read-only] 获取一个值,描述文本字段向右滚动可达到的最远位置。
TextInput
 InheritedmouseChildren : Boolean
确定对象的子项是否支持鼠标。
DisplayObjectContainer
 InheritedmouseEnabled : Boolean
指定此对象是否接收鼠标消息。
InteractiveObject
 InheritedmouseFocusEnabled : Boolean
获取或设置一个值,该值指示组件是否可以在用户单击它后获得焦点。
UIComponent
 InheritedmouseX : Number
[read-only] 指示鼠标位置的 x 坐标,以像素为单位。
DisplayObject
 InheritedmouseY : Number
[read-only] 指示鼠标位置的 y 坐标,以像素为单位。
DisplayObject
 Inheritedname : String
指示 DisplayObject 的实例名称。
DisplayObject
 InheritednumChildren : int
[read-only] 返回此对象的子项数目。
DisplayObjectContainer
 InheritedopaqueBackground : Object
指定显示对象是否由于具有某种背景颜色而不透明。
DisplayObject
 Inheritedparent : DisplayObjectContainer
[read-only] 指示包含此显示对象的 DisplayObjectContainer 对象。
DisplayObject
 Inheritedprototype : Object
[static] 对类或函数对象的原型对象的引用。
Object
 Inheritedrestrict : String
获取或设置文本字段从用户处接受的字符串。
TextInput
 Inheritedroot : DisplayObject
[read-only] 对于加载的 SWF 文件中的显示对象,root 属性是此 SWF 文件所表示的显示列表树结构部分中的顶级显示对象。
DisplayObject
 Inheritedrotation : Number
指示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。
DisplayObject
 Inheritedscale9Grid : Rectangle
当前有效的缩放网格。
DisplayObject
 InheritedscaleX : Number
将组件的当前宽度与缩放系数相乘。
UIComponent
 InheritedscaleY : Number
将组件的当前高度与缩放系数相乘。
UIComponent
 InheritedscrollRect : Rectangle
显示对象的滚动矩形范围。
DisplayObject
  selected : Boolean
指示单元格是否包含在所有者选择的索引中。
DataGridCellEditor
 InheritedselectionBeginIndex : int
[read-only] 获取包含一个或多个字符的选定内容中第一个所选字符的索引值。
TextInput
 InheritedselectionEndIndex : int
[read-only] 获取包含一个或多个字符的选定内容中最后一个所选字符的索引位置。
TextInput
 InheritedsoundTransform : SoundTransform
控制此 sprite 中的声音。
Sprite
 Inheritedstage : Stage
[read-only] 显示对象的舞台。
DisplayObject
 InheritedtabChildren : Boolean
确定对象的子项是否支持 Tab 键。
DisplayObjectContainer
 InheritedtabEnabled : Boolean
指定此对象是否遵循 Tab 键顺序。
InteractiveObject
 InheritedtabIndex : int
指定 SWF 文件中的对象按 Tab 键顺序排列。
InteractiveObject
 Inheritedtext : String
获取或设置字符串,其中包含当前 TextInput 组件中的文本。
TextInput
 InheritedtextField : TextField
对 TextInput 组件的内部文本字段的引用。
TextInput
 InheritedtextHeight : Number
[read-only] 文本的高度,以像素为单位。
TextInput
 InheritedtextSnapshot : TextSnapshot
[read-only] 返回此 DisplayObjectContainer 实例的 TextSnapshot 对象。
DisplayObjectContainer
 InheritedtextWidth : Number
[read-only] 文本的宽度,以像素为单位。
TextInput
 Inheritedtransform : Transform
一个对象,具有与显示对象的矩阵、颜色转换和像素范围有关的属性。
DisplayObject
 InheriteduseHandCursor : Boolean
布尔值,指示当鼠标滑过其 buttonMode 属性设置为 true 的 sprite 时是否显示手指形(手形光标)。
Sprite
 Inheritedversion : String = "3.0.0.13"
组件的版本号。
UIComponent
 Inheritedvisible : Boolean
获取或设置一个值,该值指示当前组件实例是否可见。
UIComponent
 Inheritedwidth : Number
获取或设置组件的宽度(以像素为单位)。
UIComponent
 Inheritedx : Number
获取或设置 x 坐标,该坐标表示组件在其父容器内沿 x 轴的位置。
UIComponent
 Inheritedy : Number
获取或设置 y 坐标,该坐标表示组件在其父容器内沿 y 轴的位置。
UIComponent
公共 方法
 方法定义方
  
创建新的 DataGridCellEditor 实例。
DataGridCellEditor
 Inherited
将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。
DisplayObjectContainer
 Inherited
将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。
DisplayObjectContainer
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
 Inherited
将指定字符串追加到 TextArea 所包含的最后一个字符之后。
TextInput
 Inherited
指示安全限制是否会导致出现以下情况:在列表中忽略了使用指定 point 点调用 DisplayObjectContainer.getObjectsUnderPoint() 方法时返回的所有显示对象。
DisplayObjectContainer
 Inherited
删除此组件实例中的样式属性。
UIComponent
 Inherited
确定指定显示对象是 DisplayObjectContainer 实例的子项还是该实例本身。
DisplayObjectContainer
 Inherited
将事件调度到事件流中。
EventDispatcher
 Inherited
在此组件上显示或隐藏焦点指示符。
TextInput
 Inherited
启动立即绘制操作,但不像 invalidateNow 那样使全部设置失效。
UIComponent
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。
DisplayObject
 Inherited
返回位于指定索引处的子显示对象实例。
DisplayObjectContainer
 Inherited
返回具有指定名称的子显示对象。
DisplayObjectContainer
 Inherited
返回 DisplayObject 的 child 实例的索引位置。
DisplayObjectContainer
 Inherited
检索当前具有焦点的对象。
UIComponent
 Inherited
检索有关指定文本行的信息。
TextInput
 Inherited
返回对象的数组,这些对象位于指定点下,并且是该 DisplayObjectContainer 实例的子项(或孙子项,依此类推)。
DisplayObjectContainer
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形根据 targetCoordinateSpace 参数定义的坐标系定义显示对象的边界,但不包括形状上的任何笔触。
DisplayObject
 Inherited
检索组件的样式查找链中设置的样式属性。
UIComponent
  
[static] 检索当前组件的默认样式映射。
DataGridCellEditor
 Inherited
将 point 对象从舞台(全局)坐标转换为显示对象的(本地)坐标。
DisplayObject
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
指示对象是否已经定义了指定的属性。
Object
 Inherited
计算显示对象,以确定它是否与 obj 显示对象重叠或相交。
DisplayObject
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。
DisplayObject
 Inherited
invalidate(property:String, callLater:Boolean = true):void
在未另外指定的情况下,将属性标记为无效,并在下一帧上重绘组件。
UIComponent
 Inherited
指示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
将 point 对象从显示对象的(本地)坐标转换为舞台(全局)坐标。
DisplayObject
 Inherited
[static] 将多个类的样式合并到一个对象中。
UIComponent
 Inherited
将组件移动到其父项内的指定位置。
UIComponent
 Inherited
指示指定的属性是否存在、是否可枚举。
Object
 Inherited
从 DisplayObjectContainer 实例的子列表中删除指定的 child DisplayObject 实例。
DisplayObjectContainer
 Inherited
从 DisplayObjectContainer 的子列表中指定的 index 位置删除子 DisplayObject。
DisplayObjectContainer
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
 Inherited
更改现有子项在显示对象容器中的位置。
DisplayObjectContainer
 Inherited
设置此组件的焦点。
UIComponent
  
将当前单元格设置为特定的鼠标状态。
DataGridCellEditor
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
setSelection(beginIndex:int, endIndex:int):void
设置在具有焦点的文本区域中选定内容的范围。
TextInput
 Inherited
setSize(width:Number, height:Number):void
将组件设置为指定宽度和高度。
UIComponent
 Inherited
setStyle(style:String, value:Object):void
对此组件实例设置样式属性。
UIComponent
 Inherited
startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
允许用户拖动指定的 Sprite。
Sprite
 Inherited
结束 startDrag() 方法。
Sprite
 Inherited
交换两个指定子对象的 Z 轴顺序(从前到后顺序)。
DisplayObjectContainer
 Inherited
swapChildrenAt(index1:int, index2:int):void
在子级列表中两个指定的索引位置,交换子对象的 Z 轴顺序(前后顺序)。
DisplayObjectContainer
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
验证并更新此对象的属性和布局,如果需要的话重绘对象。
UIComponent
 Inherited
返回指定对象的原始值。
Object
 Inherited
检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。
EventDispatcher
事件
 事件摘要定义方
 Inherited Flash Player 获得操作系统焦点并变为活动状态时调度。EventDispatcher
 Inherited 将显示对象添加到显示列表中时调度。DisplayObject
 Inherited 在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。DisplayObject
 Inherited 当用户在 TextInput 组件中输入更改文本时调度。TextInput
 Inherited 用户在同一 InteractiveObject 上按下并释放用户指针设备的主按钮时调度。InteractiveObject
 Inherited Flash Player 失去操作系统焦点并变为非活动状态时调度。EventDispatcher
 Inherited 如果 InteractiveObject 的 doubleClickEnabled 标志设置为 true,当用户在该对象上快速连续按下两次并释放指针设备的主按钮时调度。InteractiveObject
 Inherited 当用户按下 Enter 时调度。TextInput
 Inherited 播放头进入新帧时调度。DisplayObject
 Inherited 显示对象获得焦点后调度。InteractiveObject
 Inherited 显示对象失去焦点后调度。InteractiveObject
 Inherited 在组件可见性从可见改为不可见以后调度。UIComponent
 Inherited 用户按下某个键时调度。InteractiveObject
 Inherited 用户尝试使用键盘导航更改焦点时调度。InteractiveObject
 Inherited 用户释放某个键时调度。InteractiveObject
 Inherited 在 Flash Player 窗口中,用户在 InteractiveObject 实例上按下指针设备按钮时调度。InteractiveObject
 Inherited 用户尝试使用指针设备更改焦点时调度。InteractiveObject
 Inherited 用户移动 InteractiveObject 上的指针设备时调度。InteractiveObject
 Inherited 用户将指针设备从 InteractiveObject 实例上移开时调度。InteractiveObject
 Inherited 在 Flash Player 窗口中,用户将指针设备移动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited 在 Flash Player 窗口中,用户在 InteractiveObject 实例上释放指针设备按钮时调度。InteractiveObject
 Inherited 在 Flash Player 窗口中,鼠标滚轮滚动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited 在移动组件以后调度。UIComponent
 Inherited 将要从显示列表中删除显示对象时调度。DisplayObject
 Inherited 在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。DisplayObject
 Inherited 将要更新和呈现显示列表时调度。DisplayObject
 Inherited 在调整组件大小以后调度。UIComponent
 Inherited 用户将指针设备从 InteractiveObject 实例上移开时调度。InteractiveObject
 Inherited 用户将指针设备移动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited 在组件可见性从不可见改为可见以后调度。UIComponent
 Inherited 对象的 tabChildren 标志值发生更改时调度。InteractiveObject
 Inherited 对象的 tabEnabled 标志发生更改时调度。InteractiveObject
 Inherited 对象的 tabIndex 属性值发生更改时调度。InteractiveObject
 Inherited 当用户输入文本时调度。TextInput
样式
 样式说明定义方
 Inherited 类型: Class
当 TextInput 组件的 enabled 属性设置为 false 时用作该组件背景的类的名称。 默认值为 TextInput_disabledSkin.
TextInput
 Inherited 类型: flash.text.TextFormat
用于在禁用了按钮的情况下呈现组件标签的 TextFormat 对象。 默认值为 TextFormat("_sans", 11, 0x999999, false, false, false, '', '', TextFormatAlign.LEFT, 0, 0, 0, 0).
UIComponent
 Inherited 类型: Boolean
指示是否使用嵌入字体轮廓呈现文本字段。 如果该值为 true,则 Flash Player 使用嵌入字体轮廓呈现文本字段。 如果该值为 false,则 Flash Player 使用设备字体呈现文本字段。

如果将文本字段的 embedFonts 属性设置为 true,则必须使用应用于该文本字段的 TextFormat 对象的 font 属性来指定该文本的字体。 如果指定的字体没有嵌入 SWF 文件中,则不会显示该文本。

. 默认值为 false.
TextInput
 Inherited 类型: Number   格式: Length
用于分隔组件的外边框和焦点指示符的外边框的填充(以像素为单位)。 默认值为 2.
UIComponent
 Inherited 类型: Class
用于显示焦点指示符的外观。 默认值为 focusRectSkin.
UIComponent
  
textFormat
类型: flash.text.TextFormat
用于呈现组件标签的 TextFormat 对象。. 默认值为 null.
DataGridCellEditor
  
textPadding
类型: Number   格式: Length
文本和组件边缘之间的距离,以及文本和图标之间的距离(以像素为单位)。. 默认值为 1.
DataGridCellEditor
  
upSkin
类型: Class
用作 DataGridCellEditor 的背景和边框外观的类的名称。 默认值为 DataGridCellEditor_skin.
DataGridCellEditor
属性详细信息
data属性
data:Object  [read-write]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

获取或设置一个 Object,该 Object 表示与组件关联的数据。 设置该值后,将存储组件数据并使包含组件变为无效。 然后,将自动重绘变为无效的组件。

数据属性表示一个对象,该对象包含单元格代表的 DataProvider 中的项目。 通常,数据属性根据组件类型包含标准属性。 在 CellRenderer 中的 List 或 ComboBox 组件中,数据包含标签、图标和数据属性;在 TileList 中包含标签和源属性;DataGrid 单元格包含每列的值。 数据属性还可以包含与特定单元格相关的用户指定的数据。 用户可以针对组件扩展 CellRenderer 以在呈现单元格时利用数据的不同属性。

此外,可以使用 labelFieldlabelFunctioniconFieldiconFunctionsourceFieldsourceFunction 元素指定分别使用哪些属性来绘制标签、图标和源。


实现
    public function get data():Object
    public function set data(value:Object):void
listData属性 
listData:ListData  [read-write]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

获取或设置应用到单元格的列表属性,例如 indexselected 值。 单元格变为无效以后,这些列表属性会自动更新。


实现
    public function get listData():ListData
    public function set listData(value:ListData):void
selected属性 
selected:Boolean  [read-write]

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

指示单元格是否包含在所有者选择的索引中。 true 值指示单元格包含在指定索引中;false 值指示单元格未包含在指定索引中。

请注意,在 DataGrid 中,无法更改该值。 DataGridCellEditor 类实现 ICellRenderer 接口,该接口指定必须定义该值。

默认值为 false.


实现
    public function get selected():Boolean
    public function set selected(value:Boolean):void

另请参见

构造函数详细信息
DataGridCellEditor()构造函数
public function DataGridCellEditor()

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

创建新的 DataGridCellEditor 实例。

方法详细信息
getStyleDefinition()方法
public static function getStyleDefinition():Object

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

检索当前组件的默认样式映射。 样式映射包含适合组件的类型,具体取决于组件使用的样式。 例如,disabledTextFormat 样式包含 null 值或 TextFormat 对象。 可以使用这些样式并对当前组件调用 setStyle()。 下面的代码覆盖指定组件上默认的 disabledTextFormat 样式:
componentInstance.setStyle("disabledTextFormat", new TextFormat());

返回
Object — 默认样式对象。

示例
如何使用示例

下例为多个组件类创建一个样式浏览器:
import fl.controls.*;
import fl.containers.*;
import fl.controls.listClasses.*;
import fl.controls.dataGridClasses.*;
import fl.controls.progressBarClasses.*;
import fl.core.UIComponent;
import fl.data.DataProvider;

var dp:DataProvider = new DataProvider();
dp.addItem( { label: "BaseScrollPane",    data:BaseScrollPane } );
dp.addItem( { label: "Button",             data:Button } );
dp.addItem( { label: "CellRenderer",    data:CellRenderer } );
dp.addItem( { label: "CheckBox",         data:CheckBox } );
dp.addItem( { label: "ColorPicker",     data:ColorPicker } );
dp.addItem( { label: "ComboBox",         data:ComboBox } );
dp.addItem( { label: "DataGrid",         data:DataGrid } );
dp.addItem( { label: "HeaderRenderer",    data:HeaderRenderer } );
dp.addItem( { label: "ImageCell",        data:ImageCell } );
dp.addItem( { label: "IndeterminateBar",data:IndeterminateBar } );
dp.addItem( { label: "Label",             data:Label } );
dp.addItem( { label: "List",             data:List } );
dp.addItem( { label: "NumericStepper",     data:NumericStepper } );
dp.addItem( { label: "ProgressBar",     data:ProgressBar } );
dp.addItem( { label: "RadioButton",     data:RadioButton } );
dp.addItem( { label: "ScrollPane",         data:ScrollPane } );
dp.addItem( { label: "Slider",             data:Slider } );
dp.addItem( { label: "TextArea",         data:TextArea } );
dp.addItem( { label: "TextInput",         data:TextInput } );
dp.addItem( { label: "TileList",         data:TileList } );
dp.addItem( { label: "UILoader",         data:UILoader } );
dp.addItem( { label: "UIComponent",     data:UIComponent } );

var cb:ComboBox = new ComboBox();
cb.move(10,10);
cb.setSize(300,25);
cb.prompt = "Select a component to view its styles";
cb.rowCount = 12;
cb.dataProvider = dp;
cb.addEventListener(Event.CHANGE, showStyleDefinition);
addChild(cb);

var dg:DataGrid = new DataGrid();
dg.setSize(425,300);
dg.move(10,50);
dg.columns = [ new DataGridColumn("StyleName"), new DataGridColumn("DefaultValue") ];
addChild(dg);

function showStyleDefinition(e:Event):void {
    var componentClass:Class = e.target.selectedItem.data as Class;
    var styles:Object = componentClass["getStyleDefinition"].call(this);
    trace(styles.toString());
    var styleData:DataProvider = new DataProvider();
    for(var i:* in styles) {
        trace(i + " : " + styles[i]);
        styleData.addItem( { StyleName:i, DefaultValue:styles[i] } );
    }
    styleData.sortOn("StyleName");
    dg.dataProvider = styleData;
}
setMouseState()方法 
public function setMouseState(state:String):void

语言版本 : ActionScript 3.0
Player 版本 : Flash Player 9.0.28.0

将当前单元格设置为特定的鼠标状态。 DataGrid 需要该方法来设置当用户与单个单元格交互时整行的鼠标状态。

参数

state:String — 一个字符串,用于指定鼠标状态,例如“up”或“over”。

示例 如何使用示例

此示例演示如何处理 DataGrid 中可编辑单元格的行为。

若要运行该示例,请按照下列步骤操作:

  1. 将 DataGrid 组件添加到库中。
  2. 将该代码作为 DataGridCellEditorExample.as 另存到 FLA 文件所在的同一目录中。
  3. 将 FLA 文件中的 Document 类设置为 DataGridCellEditorExample。
package
{
    import fl.controls.DataGrid;
    import fl.controls.dataGridClasses.DataGridCellEditor;
    import fl.data.DataProvider;
    import fl.managers.StyleManager;
    import flash.display.Sprite;
    import flash.text.TextFormat;
    
    public class DataGridCellEditorExample extends Sprite
    {
        private var dg:DataGrid;
        
        public function DataGridCellEditorExample() {
            createDataGrid();
            styleDataGrid();
        }
        private function createDataGrid():void {
            dg = new DataGrid();
            addChild(dg);
            dg.setSize(200,300);
            dg.editable = true;
            
            var dp:DataProvider = new DataProvider();
            var i:uint;
            var totalRows:uint = 42;
            for(i=0; i<totalRows; i++) {
                dp.addItem( {     col1:getRandomNumber(),
                                   col2:getRandomNumber(),
                                col3:getRandomNumber() } );
            }
            dg.dataProvider = dp;            
        }
        private function styleDataGrid():void {
            var georgiaFormat:TextFormat = getCustomFormat();
            georgiaFormat.font = "Georgia";
            var verdanaFormat:TextFormat = getCustomFormat();
            verdanaFormat.font = "Verdana";
            var timesFormat:TextFormat = getCustomFormat();
            timesFormat.font = "Times New Roman";
            
            var firstCellEditor:DataGridCellEditor = getCustomEditor();
            firstCellEditor.setStyle("textFormat",timesFormat);
            var secondCellEditor:DataGridCellEditor = getCustomEditor();
            secondCellEditor.setStyle("textFormat",verdanaFormat);
            var thirdCellEditor:DataGridCellEditor = getCustomEditor();;
            thirdCellEditor.setStyle("textFormat",georgiaFormat);
            
            dg.columns[0].itemEditor = firstCellEditor;
            dg.columns[1].itemEditor = secondCellEditor;
            dg.columns[2].itemEditor = thirdCellEditor;    
        }
        private function getRandomNumber():uint {
            return Math.round(Math.random()*100);
        }
        private function getCustomFormat():TextFormat {
            var tf:TextFormat = new TextFormat();
            tf.bold = true;
            tf.color = 0xFFFFFF;
            return tf;
        }
        private function getCustomEditor():DataGridCellEditor {
            var dgce:DataGridCellEditor = new DataGridCellEditor();
            dgce.textField.background = true;
            dgce.textField.backgroundColor = 0xFF0000;
            dgce.maxChars = 2;
            dgce.restrict = "1234567890";
            return dgce
        }
    }
}




 

评论添加到页面后给我发送电子邮件 | 评论报告

当前页: http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/fl/controls/dataGridClasses/DataGridCellEditor.html