| 包 | fl.data |
| 类 | public dynamic class SimpleCollectionItem |
| 继承 | SimpleCollectionItem Object |
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
label 和 data 属性的集合列表项目,例如,ComboBox 或 List 组件。
| 属性 | 定义方 | ||
|---|---|---|---|
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。
| Object | |
| data : String
对象的数据属性。
| SimpleCollectionItem | ||
| label : String
对象的标签属性。
| SimpleCollectionItem | ||
![]() | prototype : Object
[static]
对类或函数对象的原型对象的引用。
| Object | |
| 方法 | 定义方 | ||
|---|---|---|---|
|
创建一个新 SimpleCollectionItem 对象。
| SimpleCollectionItem | ||
![]() |
指示对象是否已经定义了指定的属性。
| Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。
| Object | |
![]() |
指示指定的属性是否存在、是否可枚举。
| Object | |
![]() |
设置循环操作动态属性的可用性。
| Object | |
![]() |
返回指定对象的字符串表示形式。
| Object | |
![]() |
返回指定对象的原始值。
| Object | |
| data | 属性 |
public var data:String
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
对象的 data 属性。
默认值为 null.
| label | 属性 |
public var label:String
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
对象的 label 属性。 默认值为 label(n),其中 n 是顺序索引。
| SimpleCollectionItem | () | 构造函数 |
public function SimpleCollectionItem()
| 语言版本 : | ActionScript 3.0 |
| Player 版本 : | Flash Player 9.0.28.0 |
创建一个新 SimpleCollectionItem 对象。
若要运行该示例,请按照下列步骤操作:
package
{
import fl.controls.ComboBox;
import fl.controls.Label;
import fl.data.*;
import fl.data.SimpleCollectionItem;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextFieldAutoSize;
public class SimpleCollectionItemExample extends Sprite
{
private var dp:DataProvider;
private var cb:ComboBox;
private var myLabel:Label;
public function SimpleCollectionItemExample() {
dp = new DataProvider();
var i:uint;
for(i=0; i<42; i++) {
var sci:SimpleCollectionItem = new SimpleCollectionItem();
sci.label = "Item "+i;
sci.data = null;
dp.addItem( sci );
}
cb = new ComboBox();
cb.dataProvider = dp;
cb.addEventListener(Event.CHANGE, announceSelectedItem);
cb.move(10,40);
addChild(cb);
myLabel= new Label();
myLabel.autoSize = TextFieldAutoSize.LEFT;
myLabel.text = "";
myLabel.move(10,10);
addChild(myLabel);
}
function announceSelectedItem(e:Event):void {
var sci:SimpleCollectionItem = e.target.selectedItem as SimpleCollectionItem;
myLabel.text = "You have selected " + sci.label;
}
}
}
当前页: http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/fl/data/SimpleCollectionItem.html