436 Data Integration (Flash Professional Only)
Setting the schema path
The path property for a schema field is an optional setting that is used in special
circumstances when the schema for your component is not appropriate. Using this setting,
you can create a virtual schema field (a field that exists in one location but pulls its value from
another). The value of this property is a path expression that is entered in one of the following
formats:
■ For schemas that contain ActionScript data, the path follows the format field
[.field]...,
where field is equal to the name of a field (such as
addresslist.street).
■ For schemas that contain XML data, the path follows the format XPath, where XPath is a
standard XPath statement (such as
addressList/street).
When data binding is performed, Flash checks to see if there is a path expression for a schema
field. If so, it uses the path expression to locate the correct value. For more information, see
“Virtual schemas” on page 444.
Schema kinds
A kind determines how a schema item for your component should be accessed at runtime.
The following kinds come with Flash MX Professional 2004 and Flash Professional 8:
None The default kind. This kind is identical to the Data kind.
Data The schema item is a data structure, and the data field is stored within the data
structure as specified by the field’s schema location. This is the normal case. The data
structure can be in either ActionScript or XML form.
Calculated This kind is used with the DataSet component. You can use it to define a
calculated field (a virtual field whose value is calculated at runtime, based on the values of
other fields). You write an event handler in ActionScript code that is invoked by the
DataSet.calcFields event when any non-calculated field in a data set’s current data record
changes. The event handler must set the value of the calculated fields in that record. There is
no special processing when getting or setting the value of a calculated field. For example, in
the DataSet component you might define three fields, called
price, quantity, and
totalPrice. You would set the kind property for totalPrice to Calculated so that you
can assign it a value at runtime, as shown in the following example:
function calculatedFunct(evt) {
evt.target.totalPrice = (evt.target.price * evt.target.quantity);
}
NOTE
The path expression is always performed relative to the parent node of the schema field.