简体   繁体   English

从XML加载数据的问题

[英]Problem with loading data from the XML

I have XML file 我有XML文件

<contact>
<title>Flex</title>
<title>Flash</title>
<title>Illustrator</title>
<title>Photoshop</title>
<title>Dreamweawer</title>
<title>Flash player</title>

in my application is tilelist which loads data from XML why I can not take the name of the selected item in the TextInput? 在我的应用程序中是tilelist,它从XML加载数据为什么我不能在TextInput中获取所选项目的名称?

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" applicationComplete="contactsService.send()">
<fx:Declarations>
<mx:HTTPService id="contactsService"
                resultFormat="e4x"
                url="contacts.xml"/>
</fx:Declarations>


<fx:Script>
    <![CDATA[
        import mx.events.ItemClickEvent;
        import mx.events.ListEvent;

        public function SomthingSelected ():void {
            txt.text = this.tileList.selectedItem.@title;   
        }

    ]]>
</fx:Script>
<mx:TileList id="tileList"
             dataProvider="{contactsService.lastResult.title}"
             columnCount="4"
             columnWidth="125"
             rowCount="2"
             rowHeight="100"
             verticalScrollPolicy="on" 
             itemClick="SomthingSelected ()"/>

<s:TextInput x="10" y="223" id="txt" text="Sergii hi"/>

Help me please ( 请帮帮我 (

You don't need to specify the tag as the data is already there. 您不需要指定标记,因为数据已存在。 Try doing this: 试着这样做:

private function SomthingSelected ():void {
            txt.text = this.tileList.selectedItem.toString();   
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM