作者worlds0731 (宅度還不夠)
看板Flash
標題Re: [問題]請教 Flex 的<Label> text屬性如何從資긠…
時間Thu Sep 17 13:25:13 2009
※ 引述《worlds0731 (宅度還不夠)》之銘言:
: 我翻閱了許多書籍以及上網找資料,都找不到相關解決的辦法
: 這個瓶頸已經卡了一個禮拜多了...真的苦無對策..才到這邊向各位前輩請教...
: 希望各位前輩們能給我些意見或者方向(ㄒ_ㄒ)ˊˊ
: 我照著工具書上一步步建立了一個與SQLserver連線的WebService
: 是以DataGrid的方式呈現:
: <mx:DataGrid id="dataGrid"
: dataProvider="{dataArr}"
: rowCount="8"
: editable="true"
: resizableColumns="true"
: headerRelease="setOrder(event);"
: right="10" left="10" top="10" bottom="71">
: <mx:columns>
: <mx:DataGridColumn headerText="mem_id" dataField="mem_id" />
: <mx:DataGridColumn headerText="friend_id" dataField="friend_id" />
: <mx:DataGridColumn headerText="group_id" dataField="group_id" />
: </mx:columns>
: </mx:DataGrid>
: ------------------------------我是分隔線------------------------------------
: 而我想再用一個<mx:Label> 抓SQLserver的值出來顯示:
: <mx:Repeater id="Data" dataProvider="{dataArr}">
: <mx:VBox width="10%" height="10%">
: <mx:Label id="A" text="{mem_id}" />
: <mx:Label id="B" text="{dataArr.mem_id}"/>
: </mx:VBox>
: </mx:Repeater>
: Label A 跟Label B是我嘗試的兩個方法:
: A(直接輸入欄位名稱):編譯時出現「1120: 存取未定義的屬性 mem_id。」
: B(指定路徑):編譯時出現「1119: 存取可能未定義的屬性 mem_id (透
: 過靜態類型mx.collections:ArrayCollection 的參考)。」
: ---------------------------------附註-----------------------------------
: 1. WebService id="dataArr".
: 2. <mx:Repeater>我不清楚這個物件在做什麼,只是看到他有dataProvider這個屬性
: 就拿來用了
: 3. 非常感謝您撥冗看完這篇文章
: (文章很長我有盡量做排版保護大家的眼睛..囧)
----------------------------------9/17----------------------------------------
我把檔案上傳至ZShare空間:
http://www.zshare.net/download/65686794c998e63e/
iResult.mxml、iResultScript.as 和 iResultconfig.as 是可以執行的.
iTEST2.mxml 及 print2.as 則是我正在修改的實驗組.
(.as檔我都有加註解,方便各位前輩消化...謝orz...)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.131.7.16
→ worlds0731:剛找到錯誤WebService id應該是gateway才對.. 09/17 13:55
→ worlds0731:所以我改成 text="gateway.mem_id" 編譯時從原本的 09/17 13:56
→ worlds0731:"錯誤" 變成 "警告" !? 可執行但還是沒有顯示出資料 09/17 13:57
→ worlds0731:補上資料表欄位: mem_id、 friend_id 和 group_id 09/17 14:03
→ worlds0731:資料型別都是varchar(50) 09/17 14:04