点击这里使用RSS订阅本Blog: title="RSS 2.0" type="application/rss+xml" href="http://feed.feedsky.com/softwave" rel="alternate">
<script type="text/javascript" src="http://www.google.com/reader/ui/publish<script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/00697638153916680411/state/com.google/broadcast?n=5&callback=grc_p%28%7bc%3a%22green%22%2ct%3a%22%5cu8fd9%5cu4e9b%5cu6587%5cu7ae0%5cu4e5f%5cu503c%5cu5f97%5cu4e00%5cu770b%22%2cs%3a%22false%22%7d%29%3bnew%20grc"></script>%22%7D%29%3Bnew%20GRC">
其一,用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>
其二:用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>
其中,XML数据如下:
- <?xml version="1.0"?>
- <products>
- <product>
- <name>Name</name>
- <price>Price</price>
- <freeship>Free Shipping?</freeship>
- </product>
- <product>
- <name>Whirlygig</name>
- <price>5</price>
- <freeship>false</freeship>
- </product>
- <product>
- <name>Tilty Thingy</name>
- <price>15</price>
- <freeship>true</freeship>
- </product>
- <product>
- <name>Really Big Blocks</name>
- <price>25</price>
- <freeship>true</freeship>
- </product>
- </products>
请注意数据集的细微差别。
摘自【http://www.5uflash.com/Flex-AIR/flexziliao/list_17_2.html】