Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 使用XML文件和VBox容器以手风琴显示数据时出现问题_Apache Flex_Flex4_Flexbuilder - Fatal编程技术网

Apache flex 使用XML文件和VBox容器以手风琴显示数据时出现问题

Apache flex 使用XML文件和VBox容器以手风琴显示数据时出现问题,apache-flex,flex4,flexbuilder,Apache Flex,Flex4,Flexbuilder,我正在使用一个XML文件来填充我的手风琴。但我遗漏了一点,那就是手风琴中没有显示VBox的标签。我试图从我的XML文件中获取标签,即每个用户的“名称”应该以手风琴的形式出现在每个Vbox上 您能否在以下代码中发现任何逻辑错误: XML文件:currentUsers.XML <currentUsers> <user> <name>Tom</name>

我正在使用一个XML文件来填充我的手风琴。但我遗漏了一点,那就是手风琴中没有显示VBox的标签。我试图从我的XML文件中获取标签,即每个用户的“名称”应该以手风琴的形式出现在每个Vbox上

您能否在以下代码中发现任何逻辑错误:

XML文件:currentUsers.XML

 <currentUsers>     
               <user>   
                  <name>Tom</name>  
                  <age>34</age>
               </user>
               <user>   
                  <name>Jerry</name>    
                  <age>99</age>
              </user>
 </currentUsers>

汤姆
34
杰瑞
99
MXML文件:

 <fx:Script>
            <![CDATA[
                import mx.rpc.events.ResultEvent;
                import mx.collections.ArrayCollection;

            [Bindable] private var userArray : ArrayCollection;

            private function serviceHandler(event:ResultEvent):void{
                userArray = event.result.currentUsers.user;
            }   

            private function send_data():void{ 
                    service.send(); 
            } 
        ]]>
    </fx:Script>

<fx:Declarations>
        <mx:HTTPService id="service" url="currentUsers.xml" result="serviceHandler(event)"/>
    </fx:Declarations>

<mx:Accordion includeIn="UserList" x="10" y="10" width="554" height="242">
        <mx:Repeater id="rep" dataProvider="{userArray}">
            <mx:VBox width="100%" height="100%"
                     verticalAlign="middle" horizontalAlign="center"
                     label="{rep.currentItem.user}"  >
            </mx:VBox>
        </mx:Repeater>
</mx:Accordion>

别客气。发现了问题

VBox的标签应设置为currentItem.name,而不是currentItem.user

<mx:VBox width="100%" height="100%"
                     verticalAlign="middle" horizontalAlign="center"
                     label="{rep.currentItem.name}"  >
</mx:VBox>

谢谢大家