[]导出到微信小游戏资源加载失败回调不执行
使用laya导出到微信小游戏,图片资源放入远程CDN,当图片资源加载失败时(远程CDN没有该图片)没有调用回调。
查看MiniFileMgr.as发现仅当statusCode为200时才会触发回调,源码如下
public static function downFiles(fileUrl:String, encoding:String = "ascii", callBack:Handler = null, readyUrl:String = "",isSaveFile:Boolean = false,fileType:String = "",isAutoClear:Boolean =true):void {
var downloadTask:* = wxdown({url: fileUrl, success: function(data:Object):void {
if (data.statusCode === 200)
readFile(data.tempFilePath, encoding, callBack, readyUrl,isSaveFile,fileType,isAutoClear);
else
callBack != null && callBack.runWith([1, data]);
}, fail: function(data:Object):void {
callBack != null && callBack.runWith([1, data]);
}});
//获取加载进度
downloadTask.onProgressUpdate(function(data:Object):void {
callBack != null && callBack.runWith([2, data.progress]);
});
}
查看MiniFileMgr.as发现仅当statusCode为200时才会触发回调,源码如下
public static function downFiles(fileUrl:String, encoding:String = "ascii", callBack:Handler = null, readyUrl:String = "",isSaveFile:Boolean = false,fileType:String = "",isAutoClear:Boolean =true):void {
var downloadTask:* = wxdown({url: fileUrl, success: function(data:Object):void {
if (data.statusCode === 200)
readFile(data.tempFilePath, encoding, callBack, readyUrl,isSaveFile,fileType,isAutoClear);
else
callBack != null && callBack.runWith([1, data]);
}, fail: function(data:Object):void {
callBack != null && callBack.runWith([1, data]);
}});
//获取加载进度
downloadTask.onProgressUpdate(function(data:Object):void {
callBack != null && callBack.runWith([2, data.progress]);
});
}
没有找到相关结果
已邀请:
要回复问题请先登录
2 个回复
赞同来自:
Laya_XS
赞同来自: