RawAsset 类型
继承于 Object
模块: cc
父模块: cc
注册用的资源基类。
索引
属性(properties)
方法
Details
属性(properties)
_uuid
_name
_objFlags
name
该对象的名称。
示例
obj.name = "New Obj";
isValid
表示该对象是否可用(被 destroy 后将不可用)。
当一个对象的 destroy 调用以后,会在这一帧结束后才真正销毁。因此从下一帧开始 isValid 就会返回 false,而当前帧内 isValid 仍然会是 true。如果希望判断当前帧是否调用过 destroy,请使用 cc.isValid(obj, true),不过这往往是特殊的业务需求引起的,通常情况下不需要这样。
示例
var node = new cc.Node();
cc.log(node.isValid);
node.destroy();
cc.log(node.isValid);
cc.log(node.isValid);
方法
isRawAssetType
参数列表
destroy
销毁该对象,并释放所有它对其它对象的引用。
实际销毁操作会延迟到当前帧渲染前执行。从下一帧开始,该对象将不再可用。
您可以在访问对象之前使用 cc.isValid(obj) 来检查对象是否已被销毁。
示例
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;
}
}
}
_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.
参数列表
data Object the serialized json data
ctx _Deserializer