2011-04-12 52 views
0

我有XML文件問題從XML加載數據

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

在我的應用程序的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 = [email protected]; 
     } 

    ]]> 
</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"/> 

請幫助我(

+1

是您接觸式標籤關閉?'@'符號用於屬性,而不是節點值。 – Sam 2011-04-12 14:35:59

回答

2

你不需要因爲數據已經存在指定標籤試着這樣做:

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