Cocos Creator 动态改变sprite图片【转】

 changeBj: function(){
    var url = 'globalUI/video/gVideoPlayClick';
    var _this = this; cc.loader.loadRes(url,cc.SpriteFrame,function(err,spriteFrame)
    {  
      _this.isPlay.spriteFrame = spriteFrame;
     });
 
   
    //加载网络图片
        var url = "http://localhost:3274/";
        cc.loader.load({url: url, type: 'png'}, function(err,img){
            var mylogo  = new cc.SpriteFrame(img); 
            self.logo.spriteFrame = mylogo;
        });

   }

来源:https://www.cnblogs.com/luorende/archive/2018/06/04/9132093.html

posted @ 2020-07-07 15:22  小猿笔记  阅读(1901)  评论(0编辑  收藏  举报