Package | fl.data |
Class | public dynamic class SimpleCollectionItem |
Inheritance | SimpleCollectionItem Object |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
label
and
data
properties--for example, a ComboBox or List component.
Public Properties
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
data : String
The data property of the object. | SimpleCollectionItem | ||
label : String
The label property of the object. | SimpleCollectionItem | ||
prototype : Object [static]
A reference to the prototype object of a class or function object. | Object |
Public Methods
Method | Defined By | ||
---|---|---|---|
Creates a new SimpleCollectionItem object. | SimpleCollectionItem | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
Property Detail
data | property |
public var data:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The data
property of the object.
The default value is null.
label | property |
public var label:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The label
property of the object.
The default value is label(n)
, where n is the ordinal index.
Constructor Detail
SimpleCollectionItem | () | Constructor |
public function SimpleCollectionItem()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new SimpleCollectionItem object.
Examples How to use this example
SimpleCollectionItemExample.as
This example demonstrates how to access a SimpleCollection object.
To run the example, follow these steps:
- Add the ComboBox and Label components to the library.
- Save this code as SimpleCollectionExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to SimpleCollectionExample.
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; } } }
Mon Nov 28 2011, 06:48 AM -08:00