422
Data Integration (Flash Professional Only)
For more information on working with data in the DataSet component, see the
following topics:
■
“About loading data into the DataSet component” on page 422
■
“Accessing the data” on page 424
About loading data into the DataSet component
To load data into the DataSet component, you edit the schema for the DataSet and create
data bindings that can be done either in ActionScript or on the Bindings tab of the
Component inspector. You need to edit the schema, in most cases, so that data appears
correctly in your application. For information on editing schema, see
“Adding a component
property to a schema” on page 398
and
“Adding a schema field to a schema item”
on page 400
. You can create bindings for the DataSet component in two ways:
■
An array of objects bound to the
DataSet.items
property (see
DataSet.items
in
Components Language Reference
).
■
An object bound to the
DataSet.dataProvider
property. This object should implement
the DataProvider interface; see
DataSet.dataProvider
property and “DataProvider
API” in
Components Language Reference.
The objects can be sophisticated client-side objects that mirror their server-side counterparts,
or in their simplest form, a collection of anonymous objects with public properties
representing the fields within a record of data.
The DataSet component uses functionality in the DataBinding classes. If you intend to work
with the DataSet component in ActionScript only, without using the Binding and Schema
tabs in the Component inspector to set properties, you’ll need to import the DataBinding
classes into your FLA file and set schema properties in your code.
The following examples show different ways you can load objects into the DataSet
component, using either ActionScript code or the Component inspector. The examples
assume that you have specified a schema for the DataSet component on the Schema tab first;
see the design-time example in
“Accessing the data” on page 424
.
Anonymous objects
The following ActionScript example assigns an array of 100
anonymous objects to the
items
property of the
myDataSet
instance of the DataSet
component. Each object represents a record of data.
function loadData() {
var recData = new Array();
for( var i:Number=0; i<100; i++ ) {
recData[i]= {id:i, name:String("name"+i), price:i*.5};
}
myDataSet.items = recData;
}
Содержание FLASH 8-FLASH
Страница 1: ...Using Flash ...
Страница 12: ...12 Contents ...
Страница 110: ...110 Using Symbols Instances and Library Assets ...
Страница 128: ...128 Working with Color Strokes and Fills ...
Страница 156: ...156 Drawing ...
Страница 190: ...190 Working with Text ...
Страница 224: ...224 Working with Graphic Objects ...
Страница 270: ...270 Creating Motion ...
Страница 310: ...310 Working with Video ...
Страница 362: ...362 Working with Screens Flash Professional Only ...
Страница 386: ...386 Creating Multilanguage Text ...
Страница 454: ...454 Data Integration Flash Professional Only ...
Страница 500: ...500 Publishing ...
Страница 534: ...534 Creating Accessible Content ...