MACROMEDIA FLASH MX 2004-USING FLASH Use Manual page 282

Hide thumbs Also See for FLASH MX 2004-USING FLASH:
Table of Contents

Advertisement

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 must import the DataBinding classes into your
FLA file and set schema properties in your code. For more information, see "Making data binding
classes available at runtime (Flash Professional only)" in Using Components.
The DataSet component works only with Flash Player 7.
For more information on working with data in the DataSet component, see the following topics:
"About loading data into the DataSet component" on page 282
"Accessing the data" on page 284
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
on page 262
and
for the DataSet component in two ways:
An array of objects bound to the
Components).
An object bound to the
DataProvider interface; see
Using Components.
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
Anonymous objects
objects to the
items
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};
}
282
Chapter 14: Data Integration (Flash Professional Only)
"Adding a schema field to a schema item" on page
DataSet.items
DataSet.dataProvider
DataSet.dataProvider
The following ActionScript example assigns an array of 100 anonymous
property of the
myDataSet
"Adding a component property to a schema"
property (see
property. This object should implement the
property and "DataProvider API" in
284.
instance of the DataSet component. Each object
263. You can create bindings
in Using
DataSet.items

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents