Apache flex 从XML中选择一个特定的数据项
我在一周的示例中介绍了Flex,使用下拉菜单将XML数据与XML节点集配对 对于我正在创建的项目,我只是将一个只包含一个节点的XML文件拉入我的应用程序中 所以我的问题是,我如何做到这一点 我正在使用HTTPService并将数据拉入,但目前唯一可行的方法是使用Apache flex 从XML中选择一个特定的数据项,apache-flex,flex4,Apache Flex,Flex4,我在一周的示例中介绍了Flex,使用下拉菜单将XML数据与XML节点集配对 对于我正在创建的项目,我只是将一个只包含一个节点的XML文件拉入我的应用程序中 所以我的问题是,我如何做到这一点 我正在使用HTTPService并将数据拉入,但目前唯一可行的方法是使用 我的代码如下: <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> &l
我的代码如下:
<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>
非常感谢。通过替换
channelSelection将它们绑定到原始源(HTTPService)。使用channelList.lastResult.channels.channel选择editem
<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>
我不确定我是否理解您的问题-您被困在哪里-您是否正在尝试摆脱dropdownlist?是的,这是正确的。我想摆脱下拉列表,让标签在不使用下拉列表的情况下通过XML节点。感谢我的XML(如果有帮助的话)如下:第一频道这是第一频道../img/logo_small.jpg../img/background.jpg我现在如何从XML中选择所有数据?基本上我在做IPTV服务。第一个就像你给我的建议一样,只通过一个频道。但是在那个频道里有视频,我怎么才能把它们都拉过来呢?提前感谢,我想您正在寻找datagrid、tile列表或具有适当项目呈现器的简单列表。将此作为新问题发布;不要忘记添加xml的结构。