MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Betriebsanweisung Seite 231

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 230
Build a distributed application with the Java adapter 231
2. Directly below the <![CDATA[ tag, add the following ActionScript import statements:
import mx.data.DataService;
import mx.collections.ArrayCollection;
import samples.contact.Contact;
Create variables
In this section, you add variables for the ArrayCollection and DataService objects to the script
block.
1. Directly below the import statements in the script block, add the following variable
declarations for the
ds, contacts, and contact variables:
public var ds:DataService;
public var contacts:ArrayCollection;
public var contact:Contact;
2.
Add a [Bindable] metadata tag directly above the contacts variable declaration:
[Bindable]
public var contacts:ArrayCollection;
The [Bindable] metadata tag indicates to the MXML compiler that contacts is a
bindable property. By making it a bindable property, you can bind it into the
dataProvider property of the DataGrid control and display data in the DataGrid
control.
Bind the ArrayCollection object to the DataGrid
In this section, you bind the contact ArrayCollection object to the DataGrid control’s
dataProvider property to fill the DataGrid control with data from the ArrayCollection
object.
1. Add the boldface text to the <mx:DataGrid> tag:
<mx:DataGrid id="dg" dataProvider="{contacts}" editable="true">
2.
Save the lesson2.mxml file.
Fill the ArrayCollection object with data
In this section, you write an event listener method that creates a DataService object and an
ArrayCollection object, and calls the DataServices
fill() method to fill the ArrayCollection
with data.
Seitenansicht 230
1 2 ... 226 227 228 229 230 231 232 233 234 235 236 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare