嗨,我有XML数据库如何打电话给电话并在标签中显示?我已经有标签字段,但我想在字段中拨打电话
如何?
这是我的鳕鱼
<s:List id="lst" x="73" y="197" width="295" height="214" change="lst_changeHandler(event)"
dataProvider="{arr}" fontSize="30" fontWeight="bold"
textAlign="right">
<s:labelField>RestaurantsKuwaiti</s:labelField>
http://www.mlfnt.com/lives6/13510357301.png
首先,您的XML不像列表:
<RestaurantsKuwaiti>
...
<RestaurantsOther>
...
I think it should be like:
<Restaurants>
<name>Kuwaiti</name>
</Restaurants>
<Restaurants>
<name>Syria</name>
</Restaurants>
...
使用labelfunction可以解决您的问题:
<fx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
private var xml:XML =
<dataroot>
<alldata>
<ID>1</ID>
<Main>2</Main>
<RestaurantsKuwaiti>
<phone>55555555</phone>
</RestaurantsKuwaiti>
</alldata>
</dataroot>;
[Bindable]
private var dataList:XMLListCollection = new XMLListCollection(xml.alldata);
private function labelFunc(item:Object):String {
return item.RestaurantsKuwaiti.phone;
}
]]>
</fx:Script>
<s:List dataProvider="{dataList}" labelFunction="labelFunc"/>
正如我上面提到的,"数据师"只有一个项目:" alldata"。