Apache flex 根据列表选择将条件数据提供程序调整为树

Apache flex 根据列表选择将条件数据提供程序调整为树,apache-flex,Apache Flex,这是我在名为nodesAndStuff.XML的文件中的XML数据 <?xml version="1.0" encoding="utf-8"?> <root> <node label="One" /> <node label="Two" /> <node label="Three" /> <node label="Four" /> <node label="Five" />

这是我在名为
nodesAndStuff.XML
的文件中的XML数据

<?xml version="1.0" encoding="utf-8"?>
<root>
    <node label="One" />
    <node label="Two" />
    <node label="Three" />
    <node label="Four" />
    <node label="Five" />
    <node label="Six" />
    <node label="Seven" />
    <node label="Eight" />
    <node label="Nine" />
</root>


现在,我将我的树添加到列表的正下方,并在不同的xml文件中保存了从10到19的计数,从20到29的计数。在选择列表中的标签1时,我不知道如何将包含从10到19计数的XML作为树中的单个节点连接起来。

有各种各样的方法来完成您想做的事情。根据您的示例精神,我对其进行了修改,以满足您的要求:

<fx:Script>
    <![CDATA[
        private function init():void {
            processXML(one);
        }

        private function processXML(nodes:XML):void {
            xmlListColl.removeAll();
            xmlListColl.source = nodes.children();
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <fx:XML id="one" source="one.xml" />
    <fx:XML id="two" source="two.xml" />
</fx:Declarations>

<s:List id="lst"
        labelField="@label"
        horizontalCenter="0" verticalCenter="0">
    <s:dataProvider>
        <s:XMLListCollection id="xmlListColl" />
    </s:dataProvider>
</s:List>

<s:Button label="Change" click="processXML(two)" />


我不知道你刚才说了什么。请不要使用翻译人员,尽量找能为您翻译的人。也许我写错了,它是如何通过选择列表来更改树的数据提供者。尊敬的先生,我感谢您对这个问题的关注,但我想我无法提出我的问题。我的问题是当我选择列表时此时,隐藏的树控件应该是可见的,并且应该能够根据nameAndstuff.xml中的名称从xml文件中获取动态值,就像如果我根据节点标签选择索引0即“one”,那么my one.xml应该是树控件的数据提供程序源,如果选择了nodal index 1,即2,则源代码将更改为2.xml。希望尽快收到您的回复。谢谢您,@nitin,我真的不明白您在问什么。你遇到了什么问题?你试过什么?您的示例代码没有关于树控件的任何内容,因此不清楚您的实际问题是什么。
<fx:Script>
    <![CDATA[
        private function init():void {
            processXML(one);
        }

        private function processXML(nodes:XML):void {
            xmlListColl.removeAll();
            xmlListColl.source = nodes.children();
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <fx:XML id="one" source="one.xml" />
    <fx:XML id="two" source="two.xml" />
</fx:Declarations>

<s:List id="lst"
        labelField="@label"
        horizontalCenter="0" verticalCenter="0">
    <s:dataProvider>
        <s:XMLListCollection id="xmlListColl" />
    </s:dataProvider>
</s:List>

<s:Button label="Change" click="processXML(two)" />