Two methods of processing external XML in Flex

There are two methods of processing XML data in Flex, mx:Model and mx:HTTPService. Here is the example code as follows:

//First method, use mx:Model

<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">
    <mx:Model id="catalogService" source="catalog.xml" />
    <mx:ArrayCollection id="myXC" source="{catalogService.product}"/>
    <mx:Repeater id="r" dataProvider="{myXC}" startingIndex="1">
        <mx:RadioButton id="Radio" label="{r.currentItem.name}"/>
    </mx:Repeater>
</mx:Application>

Second method: use mx:HTTPService

<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" initialize="catalogService.send()">
    <mx:HTTPService id="catalogService" url="catalog.xml" resultFormat="e4x"/>
    <mx:XMLListCollection id="myXC" source="{catalogService.lastResult.product}"/>
    <mx:Repeater id="r" dataProvider="{myXC}" startingIndex="1">
        <mx:RadioButton id="Radio" label="{r.currentItem.name}"/>
    </mx:Repeater>
</mx:Application>

 

 




Comment: 0 | Read times: -
Announce commentary
Your name
Content
Validation code Code