MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 346

Components language reference
Table of Contents

Advertisement

Example
The following code creates a new sort named
that performs a descending, case-
"nameSort"
insensitive sort on the DataSet object's
field.
"name"
import mx.data.components.datasetclasses.DataSetIterator;
my_ds.addItem({name:"Milton", years:3});
my_ds.addItem({name:"mark", years:3});
my_ds.addItem({name:"Sarah", years:1});
my_ds.addItem({name:"michael", years:2});
my_ds.addItem({name:"Frank", years:2});
my_ds.addSort("nameSort", ["name"], DataSetIterator.Descending |
DataSetIterator.Unique | DataSetIterator.CaseInsensitive);
In the following example, you can dynamically add data to a DataSet component by entering
first and last names into TextInput component instances on the Stage and clicking the Submit
button. After you add items to the DataSet component, you can clear the data set by clicking
the Clear button on the Stage. Drag a DataGrid component to the Stage, and give it an
instance name of
Drag two Button components to the Stage, and give them instance
my_dg.
names of
and
. Drag a DataSet component to the Stage, and
submit_button
clear_button
give it an instance name of
. Drag two TextInput components to the Stage, and give
my_ds
them instance names of
and l
. Drag an Alert component into the
firstName_ti
astName_ti
current document's library. Add two component properties,
and
, to the
firstName
lastName
DataSet component's schema by using the Schema tab of the Component inspector. Next,
add a data binding from the
property of the DataSet component to the
dataProvider
property of the DataGrid component by using the Binding tab in
dataProvider
the Component inspector. Finally, paste the following code in the first frame of the
main timeline:
import mx.controls.Alert;
my_ds.addSort("lastFirst", ["lastName", "firstName"]);
my_dg.enabled = false;
clear_button.enabled = false;
submit_button.label = "Submit";
clear_button.label = "Clear";
my_ds.addEventListener("addItem", addItemListener);
my_ds.addEventListener("modelChanged", modelChangedListener);
submit_button.addEventListener("click", submitListener);
clear_button.addEventListener("click", clearListener);
344
Components Dictionary

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents