MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 347

Components language reference
Table of Contents

Advertisement

function modelChangedListener(evt_obj:Object):Void {
my_dg.enabled = (evt_obj.target.length > 0);
clear_button.enabled = my_dg.enabled;
}
function submitListener(evt_obj:Object):Void {
my_ds.addItem({firstName:firstName_ti.text, lastName:lastName_ti.text});
}
function addItemListener(evt_obj:Object):Void {
if ((evt_obj.item.firstName.length == 0) || (evt_obj.item.lastName.length
== 0)) {
Alert.show("Error, first name or last name cannot be blank.", "Error",
Alert.OK, _level0);
evt_obj.result = false;
} else {
firstName_ti.text = "";
lastName_ti.text = "";
}
}
function clearListener(evt_obj:Object):Void {
Alert.show("Are you sure you want to clear the data?", "Warning",
Alert.OK | Alert.CANCEL, _level0, clearConfirmListener);
}
function clearConfirmListener(evt_obj:Object):Void {
switch (evt_obj.detail) {
case Alert.OK:
my_ds.clear();
break;
case Alert.CANCEL:
break;
}
}
Select Control > Test Movie to test the document in the authoring environment. Enter some
text into both of the TextInput instances and then click the Submit button. A a new item
should be added to the DataGrid instance. Clicking the Clear button should display an Alert
component instance with a confirmation message asking if you want to clear the contents of
the DataGrid. Clicking OK clears the
(and then the dataProvider property of the DataGrid component, because of the binding).
Clicking Cancel dismisses the Alert component instance.
See also
DataSet.removeSort()
property of the DataSet component
dataProvider
DataSet.addSort()
345

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