看过论坛上的其它方法,总感觉不到位
现将总结的使用方法分享出来
cc.Class({
extends: cc.Component,
properties: {
//要改的图片
ThisPic: cc.Sprite,
//使用的图集
Atlas:{
default: null,
type: cc.SpriteAtlas
},
},
onLoad: function () {
var _this = this;
//_this.Atlas._spriteFrames 为图集对象
//对象名称:headPic 即图片名称
_this.ThisPic.spriteFrame = _this.Atlas._spriteFrames.headPic;
}
});