2013-10-03 79 views
0

我試圖解析JSON的基礎上,這裏的例子:http://blog.roku.com/developer/2012/07/16/json-support-comes-to-roku/JSON解析與Brightscript

jsonAsString = ReadAsciiFile("pkg:/json/sample1.json") 
m.json = ParseJSON(jsonAsString) 
ShowPosterScreen(m.json.Videos, true) 

我得到的調試器控制檯此消息:

Current Function: 
057: Function LoadJSONFile() as void 
058:  jsonAsString = ReadAsciiFile("pkg:/json/sample1.json") 
059:  m.json = ParseJSON(jsonAsString) 
060:  ShowPosterScreen(m.json.Videos, true) 
061: End Function 
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in ...AALAE4Bk/pkg:/source/main.brs(60) 
060:  ShowPosterScreen(m.json.Videos, true) 
Backtrace: 
Function loadjsonfile() As 
    file/line: /tmp/plugin/D...AALAE4Bk/pkg:/source/main.brs(60) 
Function handlebuttonpress(id As Integer) As 
    file/line: /tmp/plugin/D...AALAE4Bk/pkg:/source/main.brs(51) 
Function main() As 
    file/line: /tmp/plugin/D...AALAE4Bk/pkg:/source/main.brs(26) 
Local Variables: 
global &h0020 rotINTERFACE:ifGlobal 
m  &h0010 bsc:roAssociativeArray, refcnt=4 
jsonasstring &h8010 bsc:roString (2.1 was String), refcnt=1 
BrightScript Debugger> 

更新:如果我有一個Makefile並壓縮內容,並通過開發瀏覽器加載...它的工作原理。通過Eclipse導出時不起作用。

回答

0

這聽起來像某種Eclipse Brightscript插件中的錯誤,很可能在某種程度上它不會加載包含ShowPosterScreen函數的文件。

請檢查Roku Developer論壇,最頂端是討論Eclipse插件的部分。 Here is a direct link.

+0

它必須是Eclipse中的一個錯誤,即使我擁有所有最新的。我說的是,在Makefile和壓縮內容以通過瀏覽器加載後,我能夠運行它。謝謝。 – taraloca