Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Extending Our First Chart Example > Backend Interaction - Pg. 153

ChArting And MultiMediA 153 Backend interaction To simulate the behavior of the server we prepare a set of XML files and store them in the local folder. Data are orga- nized according to the same structure presented in the previ- ous example. To load data we will use the HTTPService class. As we already know, such a component has to be placed within the <fx:Declarations> tag, for it is not a visual component. We provide an ID and we specify the E4X format. This component has to directly react to the changes in the combo box, which we have previously named monthsList . We assume that data will have a URL of the following format: {month-name}.xml E4X stands for ECMAScript for XML. It is a specification that simplifies working with XML in ActionScript and Flex. For example, like jan.xml, feb.xml, etc. The month name will be provided by the item selected in the combo box. To create such a binding we define the URL property of our service as follows. <s:HTTPService url="{monthsList.selectedItem}.xml" id="dataService" resultFormat="e4x"/>