TiledMapAsset
Class
Extends Asset
Module: cc
Class for tiled map asset handling.
Index
Properties
Methods
toString
Returns the asset's url.
serialize
Provide this method at the request of AssetDB.
createNode
Create a new node using this asset in the scene....
_setRawAsset
Set native file name for this asset.
addRef
Add references of asset
decRef
Reduce references of asset and it will be auto released when refCount equals 0.
destroy
Actual object destruction will delayed until before rendering.
_destruct
Clear all references in the instance.
_onPreDestroy
Called before the object being destroyed.
_serialize
The customized serialization for this object.
_deserialize
Init this object from the custom serialized data.
Details
Properties
textures
textureNames
textureSizes
imageLayerTextures
imageLayerTextureNames
url
cc.Asset.url
is deprecated, please use nativeUrl instead
_uuid
loaded
Whether the asset is loaded or not.
nativeUrl
Returns the url of this asset's native object, if none it will returns an empty string.
refCount
The number of reference
_native
Serializable url for native asset.
_nativeAsset
The underlying native asset of this asset if one is available.
This property can be used to access additional details or functionality releated to the asset.
This property will be initialized by the loader if _native
is available.
_name
_objFlags
name
The name of the object.
Examples
obj.name = "New Obj";
isValid
Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)
When an object's destroy
is called, it is actually destroyed after the end of this frame.
So isValid
will return false from the next frame, while isValid
in the current frame will still be true.
If you want to determine whether the current frame has called destroy
, use cc.isValid(obj, true)
,
but this is often caused by a particular logical requirements, which is not normally required.
Examples
var node = new cc.Node();
cc.log(node.isValid);
node.destroy();
cc.log(node.isValid);
cc.log(node.isValid);
Methods
toString
Returns the asset's url.
The Asset
object overrides the toString()
method of the Object
object.
For Asset
objects, the toString()
method returns a string representation of the object.
JavaScript calls the toString()
method automatically when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.
serialize
Provide this method at the request of AssetDB.
createNode
Create a new node using this asset in the scene.
If this type of asset dont have its corresponding node type, this method should be null.
Parameters
_setRawAsset
Set native file name for this asset.
Parameters
addRef
Add references of asset
decRef
Reduce references of asset and it will be auto released when refCount equals 0.
destroy
Destroy this Object, and release all its own references to other objects.
Actual object destruction will delayed until before rendering.
From the next frame, this object is not usable anymore.
You can use cc.isValid(obj)
to check whether the object is destroyed before accessing it.
Examples
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)
Parameters
_deserialize
Init this object from the custom serialized data.
Parameters
data
Object the serialized json data
ctx
_Deserializer