MACROMEDIA FLASH MX 2004-USING COMPONENTS Use Manual page 37

Using components
Hide thumbs Also See for FLASH MX 2004-USING COMPONENTS:
Table of Contents

Advertisement

};
// If you are unable to connect to the remote web service, display the
// error messages in the Output panel.
myProblems.onFault = function(error:Object) {
trace("error:");
for (var prop in error) {
trace("
}
};
Load the external XML file listing product information
Next you'll add a line of code that causes the XMLConnector instance to load, parse, and bind
the contents of the remote products.xml file. This file is located at the URL you entered for the
property of the XMLConnector instance that you created earlier. The file contains
URL
information on the products that will appear in the Gift Ideas section of the application.
Add the following code in the Actions panel:
products_xmlcon.trigger();
Add an event listener to filter the products displayed in the Gift Ideas section
You'll add an event listener to detect when a user selects a blunder in the What Did You Do?
section (the problems_cb ComboBox instance). The listener includes a function that filters the
Gift Ideas list according to the blunder the user chooses. Selecting a minor blunder displays a list
of modest gifts (such as a CD or flowers); selecting a more serious blunder displays more opulent
gifts.
For more information on working with event listeners, see "Using event listeners" in Using
ActionScript in Flash.
In the Actions panel, add the following code:
/* Define a listener for the problems_cb ComboBox instance.
This listener will filter the products in the DataSet (and DataGrid).
Filtering is based on the severity of the currently selected item in the
ComboBox. */
var cbListener:Object = new Object();
cbListener.change = function(evt:Object) {
products_ds.filtered = false;
products_ds.filtered = true;
products_ds.filterFunc = function(item:Object) {
// If the current item's severity is greater than or equal to the
selected
// item in the ComboBox, return true.
return (item.severity>=evt.target.selectedItem.severity);
};
};
// Add the listener to the ComboBox.
problems_cb.addEventListener("change", cbListener);
"+prop+" -> "+error[prop]);
Add ActionScript to the main Timeline
37

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING COMPONENTS and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents