SpriteAtlas
类型
继承于 RawAsset
模块: cc
精灵图集资源类。
索引
属性(properties)
方法
getTexture
Returns the texture of the sprite atlasgetSpriteFrame
Returns the sprite frame correspond to the given key in sprite atlas.getSpriteFrames
Returns the sprite frames in sprite atlas.destroy
销毁该对象,并释放所有它对其它对象的引用。
销毁后,CCObject 不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。 实际销毁操作会延迟到当前帧渲染前执行。_destruct
Clear all references in the instance.
NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject. You can override the _destruct method if you need, for example: _destruct: function () { for (var key in this) { if (this.hasOwnProperty(key)) { switch (typeof this[key]) { case 'string': this[key] = ''; break; case 'object': case 'function': this[key] = null; break; } } }
_onPreDestroy
Called before the object being destroyed._serialize
The customized serialization for this object. (Editor Only)_deserialize
Init this object from the custom serialized data.
Details
属性(properties)
_uuid
meta | description |
---|---|
类型 | String |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/assets/CCRawAsset.js:49 |
_name
meta | description |
---|---|
类型 | String |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:50 |
_objFlags
meta | description |
---|---|
类型 | Number |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:57 |
name
该对象的名称。
meta | description |
---|---|
类型 | String |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:208 |
示例
obj.name = "New Obj";
isValid
表示该对象是否可用(被销毁后将不可用)。
meta | description |
---|---|
类型 | Boolean |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:225 |
示例
cc.log(obj.isValid);
方法
getTexture
Returns the texture of the sprite atlas
meta | description |
---|---|
返回 | Texture2D |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/assets/CCSpriteAtlas.js:45 |
getSpriteFrame
Returns the sprite frame correspond to the given key in sprite atlas.
meta | description |
---|---|
返回 | SpriteFrame |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/assets/CCSpriteAtlas.js:61 |
参数列表
key
String
getSpriteFrames
Returns the sprite frames in sprite atlas.
meta | description |
---|---|
返回 | [SpriteFrame] |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/assets/CCSpriteAtlas.js:71 |
destroy
销毁该对象,并释放所有它对其它对象的引用。
销毁后,CCObject 不再可用。您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
实际销毁操作会延迟到当前帧渲染前执行。
meta | description |
---|---|
返回 | Boolean |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:246 |
示例
obj.destroy();
_destruct
Clear all references in the instance.
NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject. You can override the _destruct method if you need, for example: _destruct: function () { for (var key in this) { if (this.hasOwnProperty(key)) { switch (typeof this[key]) { case 'string': this[key] = ''; break; case 'object': case 'function': this[key] = null; break; } } }
meta | description |
---|---|
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:379 |
_onPreDestroy
Called before the object being destroyed.
meta | description |
---|---|
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:412 |
_serialize
The customized serialization for this object. (Editor Only)
meta | description |
---|---|
返回 | object |
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:437 |
参数列表
exporting
Boolean
_deserialize
Init this object from the custom serialized data.
meta | description |
---|---|
定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/platform/CCObject.js:447 |
参数列表
data
Object the serialized json datactx
_Deserializer