/**
* Author:W
* 使用AssetsManager加载远程资源
*/
cc.Class({
extends: cc.Component,
properties: {
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.loadRemoteUrlAsset();
},
start () {
setTimeout(function(){
this.releaseAsset();
}.bind(this),5000);
},
//加载服务器端资源
loadRemoteUrlAsset()
{
cc.log("加载远程资源 texture");
var remoteUrl = "http://unknown.org/someres.png";
cc.assetManager.loadRemote(remoteUrl, function (err, texture) {
this.texture = texture;
});
},
//资源释放
releaseAsset:function()
{
cc.assetManager.releaseAsset(this.texture);
cc.log("texture 资源释放");
},
// update (dt) {},
});
AssetManager加载远程资源
最新推荐文章于 2025-02-06 17:10:57 发布