User Guide

360 Components Dictionary
Download a copy of the following XML document and save it to your local hard disk: http:/
/www.helpexamples.com/flash/xml/reviews.xml
. This XML document will be loaded
dynamically using the XMLConnector component, but you’ll use the local copy to import the
XML schema into the DataSet component. Select the XMLConnector instance on the Stage
and select the Schema tab from the Component inspector. Select the
results property and
click the “Import a schema from a sample XML file” button. Select the XML document that
you downloaded to your local hard disk and click Open. The schema of the XML document
should be imported into the DataSet component. With the
reviews_xmlconn
XMLConnector instance still selected on the Stage, add a binding from the
reviews_xmlconn.results.reviews.review array to the dataProvider property of the
reviews_ds DataSet instance. Set the direction of the data binding to “out” in the Bindings
tab. Select the
reviews_ds DataSet instance on the Stage and add another binding for the
dataProvider property. With the reviews_ds instance selected, select the Bindings tab of
the Component inspector. Click the Add binding button and add a binding from the
dataProvider property of the DataSet component to the dataProvider property of the
reviews_dg DataGrid instance.
Add the following code to Frame 1 of the main timeline:
editorsChoice_ch.label = "Editor's Choice";
reviews_xmlconn.direction = "receive";
reviews_xmlconn.multipleSimultaneousAllowed = false;
reviews_xmlconn.URL = "http://www.helpexamples.com/flash/xml/reviews.xml";
reviews_xmlconn.trigger();
reviews_dg.setSize(320, 240);
reviews_dg.addColumn("name");
reviews_dg.addColumn("rating");
reviews_dg.addColumn("reviewDate");
reviews_dg.getColumnAt(0).width = 100;
reviews_dg.getColumnAt(1).width = 100;
reviews_dg.getColumnAt(2).width = 100;
reviews_dg.setStyle("alternatingRowColors", [0xFFFFFF, 0xF6F6F6]);
editorsChoice_ch.addEventListener("click", editorsChoiceListener);
function editorsChoiceListener(evt_obj:Object):Void {
reviews_ds.filtered = evt_obj.target.selected;
reviews_ds.filterFunc = function(item:Object):Boolean {
return (item.editorsChoice == 1);
};
}