1
我正在嘗試調整我從公共照片源加載的閃爍大小的照片。我能夠獲取照片並用添加孩子查看照片,但如果我嘗試調整它們的大小,它們將不會加載,並且我沒有收到任何錯誤。調整我從公共閃爍源加載的圖像大小
下面是代碼:
public function onClick(e:MouseEvent):void{
urlloader=new URLLoader();
var req=new URLRequest("http://api.flickr.com/services/feeds/photos_public.gne");
var urlvars:URLVariables=new URLVariables();
urlvars.format ="rss_200";
urlvars.tags="cat";
req.data=urlvars;
urlloader.addEventListener(Event.COMPLETE, onXMLLoaded);
urlloader.load(req);
}
public function onXMLLoaded(e:Event):void{
trace(urlloader.data);
var xml:XML = new XML (urlloader.data);
urls=[];
var mediaNS:Namespace=new Namespace("http://search.yahoo.com/mrss/");
for(var i:int =0; i<xml.channel.item.length();i++){
urls.push(xml.channel.item[i].mediaNS::[email protected]);
}
//trace(xml.channel.item[i].guid.height.mediaNS::[email protected]);
loadPhotos();
trace(urls.length);
trace(urls[1]);
}
public function loadPhotos():void{
var ldr:Loader = new Loader();
var req:URLRequest=new URLRequest(urls[1]);
ldr.load(req);
trace("image loaded");
addChild(ldr);
ldr.width=200;
ldr.height=200;
}