MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 343

Components language reference
Table of Contents

Advertisement

The following example demonstrates how you can accept or reject an item's insertion into the
DataSet by setting the result to
Drag a DataSet component to the Stage, and assign it an instance name of
DataGrid component to the Stage, and give it an instance name of
component to the Stage, and give it an instance name of
the Stage, and give it an instance name of
, to the DataSet component by using the Schema tab of the Component
occupation
inspector. Create a binding between the
my_dg.dataProvider
Add the following ActionScript to Frame 1 of the main timeline:
my_ds.addEventListener("addItem", addItemListener);
submit_button.addEventListener("click", submitListener);
function userHasAdminPrivs():Boolean {
return my_ch.selected;
}
function addItemListener(evt_obj:Object):Void {
if (userHasAdminPrivs()) {
// Allow the item addition.
evt_obj.result = true;
trace("Item added");
} else {
// Don't allow the item addition; user doesn't have admin privileges.
evt_obj.result = false;
trace("Error, insufficient permissions");
}
}
function submitListener(evt_obj:Object):Void {
my_ds.addItem({name:"bobo", occupation:"clown"});
}
See also
DataSet.createItem()
or
true
false
submit_button
my_ds.dataProvider
property by using the Bindings panel of the Component inspector.
within the handler for the
my_dg
. Drag a Button component to
my_ch
. Add two properties,
property and the
event.
addItem
. Drag a
my_ds
. Drag a CheckBox
and
name
DataSet.addItem()
341

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents