Selecting One Particular Data Item from XML
I've followed the Flex in a week example, with th开发者_如何学JAVAe drop down menu that pairs the XML data to the XML node set.
For the project I am creating, I am just pulling through ONE XML file containing just one node into my application.
So my question is, How do I achieve this?
I am using HTTPService and pulling the data through, but at present the only way for this to work is by using the <s:DropDownList>
My code is as follows :
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="channelList"
url="http://www.spriing.dev/videolist/createxml.php"
showBusyCursor="true">
</s:HTTPService>
</fx:Declarations>
<s:Group>
<mx:Image id="backgroundImg" source="{channelSelection.selectedItem.background_image}" width="100%" height="100%" scaleContent="true"/>
</s:Group>
<s:Group>
<mx:FormItem label="Select Your Channel : ">
<s:DropDownList id="channelSelection" dataProvider="{channelList.lastResult.channels.channel}" labelField="name" width="196"/>
</mx:FormItem>
<s:Label text="{channelSelection.selectedItem.name}" x="0" y="45" width="331"/>
<s:Label text="{channelSelection.selectedItem.description}" x="0" y="72" width="331"/>
<mx:Image source="{channelSelection.selectedItem.logo}" x="2" y="95" />
</s:Group>
Many Thanks in advance..
Bind them to the original source (the HTTPService) by replacing channelSelection.selectedItem
with channelList.lastResult.channels.channel
<s:Group>
<mx:Image id="backgroundImg" width="100%" height="100%" scaleContent="true"
source="channelList.lastResult.channels.channel.background_image}" />
</s:Group>
<s:Group>
<s:Label text="{channelList.lastResult.channels.channel.name}"
x="0" y="45" width="331"/>
<s:Label text="{channelList.lastResult.channels.channel.description}"
x="0" y="72" width="331"/>
<mx:Image source="{channelList.lastResult.channels.channel.logo}" x="2" y="95" />
</s:Group>
精彩评论