我在一周的示例中遵循了Flex,其下拉菜单将XML数据与XML节点集配对。
对于我正在创建的项目,我只是通过一个包含一个节点的XML文件到我的应用程序中。
所以我的问题是,我如何实现这一目标?
我正在使用HTTPService并提取数据,但目前唯一可行的方法是使用<s:DropDownList>
我的代码如下:
<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>
非常感谢提前..
答案 0 :(得分:1)
将channelSelection.selectedItem
替换为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>