使用以下代码从网络上下载图片内容后,怎么把图片流赋值给精灵啊
var xhr = cc.loader.getXMLHttpRequest();
var thisVar = this;
xhr.onreadystatechange = function () {
var arraybuffer = xhr.response;
cc.log('arraybuffer is ’ + arraybuffer);
var temp = new cc.SpriteFrame;
temp = arraybuffer;
thisVar.img.getComponent(cc.Sprite).spriteFrame = temp;
};
xhr.timeout = 3000;
xhr.responseType = “arraybuffer”;
var myDate = new Date();
//var url = config.g_HttpUrl + “Image/DownLoadImage.ashx”;
var url = “http://61.36.72.42/phoneDdService/Image/DownLoadImage.ashx”;
cc.log(url);
xhr.open(“GET”, encodeURI(url), true);
xhr.send();
你们可以看看 http://61.36.72.42/phoneDdService/Image/DownLoadImage.ashx 这个链接打开就是一张图片的,但是代码里取不出来,设置了无效

