2014-01-13 29 views
0

我正在製作一個新聞滑塊,用於從php腳本加載內容。問題是,當我把網址進入的BitmapImage爲縮略圖源,圖像從未加載:基於Flex BitmapImage不會從URL加載

var newsItemThumb:BitmapImage = new BitmapImage(); 
         newsItemThumb.source = XMLReader.newsItem[i].thumb; 
         newsItemThumb.fillMode = "stretch"; 
         newsItemThumb.width = 100; 
         newsItemThumb.height = 100; 

         // add the thumb to news 
         newsItem.addElement(newsItemThumb); 
+0

我確實爲此工作過,但不確定它爲什麼發生。我將XMLReader.newsItem [i] .thumb的值設置爲一個字符串變量,它的工作方式非常奇怪! – Glen

回答

0

您的代碼上面,也許代碼的下方

XMLReader.newsItem[i].thumb; 

值是空的或null。你可以嘗試調試你的代碼,讓我們看看它的當前價值是什麼?

+0

我實際上已經解決它,但不確定它爲什麼發生。我將XMLReader.newsItem [i] .thumb的值設置爲一個字符串變量,它的工作方式非常奇怪! – Glen

+0

很酷。它看起來似乎XMLReader.newsItem [i] .thumb的值是空的。 :) – bbontilao