[問題] flex repeater的用法

看板Flash作者 (守護勇氣)時間15年前 (2009/08/12 23:47), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
小妹最近想嘗試用flex 的repeater來產生想要的呈現的樣子 但是一直沒辦法成功~"~ 以下是我測試用的程式碼 <?xml version="1.0" encoding="utf-8"?> <mx:Application creationComplete="init()" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="Components.*"> <mx:Script> <![CDATA[ [Bindable] private var testArray:Array = new Array(); private function init():void{ for(var i:int=1; i<10; i++){ testArray.push(i); } } ]]> </mx:Script> <ns1:testMonthBlock x="10" y="10" id="blk0"></ns1:testMonthBlock> <mx:Repeater id="myRp" dataProvider="{testArray}"> <mx:HBox x="10" y="10" width="694" height="22"> <mx:Label text="{String(myRp.currentItem)}" width="100" textAlign="right" fontSize="12"/> </mx:HBox> </mx:Repeater> </mx:Application> 想請教大大們 哪出了問題? 執行時都沒有東西... >"< 或是套件的使用方法、語法有錯?? 另外,關於array以及 arraycollection的差異 雖然有查過資料了...但還是搞不懂~"~ 麻煩大大們也順便解答一下 謝謝^^ P.S. testMonthBlock是另外寫的component -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.171.60.189 ※ 編輯: deepinside 來自: 218.171.60.189 (08/13 00:54)

08/13 16:16, , 1F
Array與ArrayCollection的差異在於AC的大小是可變動的
08/13 16:16, 1F

08/13 16:18, , 2F
Repeater的dataProvider必須是ArrayCollection
08/13 16:18, 2F

08/14 16:04, , 3F
嗯嗯~~ 了解!!! 謝謝aitch大大:)
08/14 16:04, 3F

08/14 16:05, , 4F
另外 我也發現我repeater的位置放錯了= ="
08/14 16:05, 4F
文章代碼(AID): #1AWkGVOS (Flash)