MACROMEDIA FLASH 8-USING FLASH Use Manual page 422

Using flash
Table of Contents

Advertisement

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
property to a schema" on page 398
on page
400. You can create bindings for the DataSet component in two ways:
An array of objects bound to the
Components Language Reference).
An object bound to the
the DataProvider interface; see
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
Anonymous objects
anonymous objects to the
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;
}
422
Data Integration (Flash Professional Only)
and
"Adding a schema field to a schema item"
DataSet.items
DataSet.dataProvider
DataSet.dataProvider
"Accessing the data" on page
The following ActionScript example assigns an array of 100
property of the
items
"Adding a component
property (see
DataSet.items
property. This object should implement
property and "DataProvider
424.
instance of the DataSet
myDataSet
in

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-USING FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF