我有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 = 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"/>
请帮帮我(
答案 0 :(得分:2)
您不需要指定标记,因为数据已存在。试着这样做:
private function SomthingSelected ():void {
txt.text = this.tileList.selectedItem.toString();
}