我正在處理一個小圖片庫。我創建一個xml文件,並嘗試使用itemrenderer將其鏈接到我的List控件。但是,當我試圖保存文件時,我得到了未定義屬性「數據」錯誤的訪問權限。我認爲我們假設使用「數據」來引用數據對象的當前行。這是我的代碼...並且非常感謝!Flex列表控件itemrenderer問題
<?xml version="1.0" encoding="utf-8"?>
<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">
<fx:Declarations>
<fx:Model id="pictureXML" source="data/pictures.xml"/>
<s:ArrayList id="pictureArray" source="{pictureXML.picture}"/>
</fx:Declarations>
<s:List id="pictureGrid" dataProvider="{pictureArray}"
horizontalCenter="0" top="20">
<s:itemRenderer>
<fx:Component>
<s:HGroup>
<mx:Image source="images/big/{data.source}" /> // where the error happen
<s:Label text="{data.caption}"/> // where the error happen
</s:HGroup>
</fx:Component>
</s:itemRenderer>
</s:List>
</s:Application>
我的XML
<?xml version="1.0"?>
<album>
<picture>
<source>city1.jpg </source>
<caption>City View 1</caption>
</picture>
<picture>
<source>city2.jpg </source>
<caption>City View 2</caption>
</picture>
<picture>
<source>city3.jpg </source>
<caption>City View 3</caption>
</picture>
<picture>
<source>city4.jpg </source>
<caption>City View 4</caption>
</picture>
<picture>
<source>city5.jpg </source>
<caption>City View 5</caption>
</picture>
<picture>
<source>city6.jpg </source>
<caption>City View 6</caption>
</picture>
<picture>
<source>city7.jpg </source>
<caption>City View 7</caption>
</picture>
<picture>
<source>city8.jpg </source>
<caption>City View 8</caption>
</picture>
<picture>
<source>city9.jpg </source>
<caption>City View 9</caption>
</picture>
<picture>
<source>city10.jpg </source>
<caption>City View 10</caption>
</picture>
</album>
我明白任何幫助!
錯誤只發生在mx:圖像行或mx:圖像和s:標籤? – NKijak 2011-07-11 17:53:55