diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 24c7e64..64ed31d 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -544,3 +544,12 @@ renderer.maskManager.popMask(renderer); } }; + +/** + * Destroys the container + * + */ +Container.prototype.destroy = function () +{ + this.children = null; +}; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 24c7e64..64ed31d 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -544,3 +544,12 @@ renderer.maskManager.popMask(renderer); } }; + +/** + * Destroys the container + * + */ +Container.prototype.destroy = function () +{ + this.children = null; +}; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index d4dcb35..048b84a 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -439,3 +439,24 @@ return renderTexture; }; + +/** + * Base destroy method for generic display objects + * + */ +DisplayObject.prototype.destroy = function () +{ + + this.position = null; + this.scale = null; + this.pivot = null; + + this._bounds = null; + this._currentBounds = null; + this._mask = null; + + this.worldTransform = null; + this.filterArea = null; + + this.listeners = null; +}; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 24c7e64..64ed31d 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -544,3 +544,12 @@ renderer.maskManager.popMask(renderer); } }; + +/** + * Destroys the container + * + */ +Container.prototype.destroy = function () +{ + this.children = null; +}; diff --git a/src/core/display/DisplayObject.js b/src/core/display/DisplayObject.js index d4dcb35..048b84a 100644 --- a/src/core/display/DisplayObject.js +++ b/src/core/display/DisplayObject.js @@ -439,3 +439,24 @@ return renderTexture; }; + +/** + * Base destroy method for generic display objects + * + */ +DisplayObject.prototype.destroy = function () +{ + + this.position = null; + this.scale = null; + this.pivot = null; + + this._bounds = null; + this._currentBounds = null; + this._mask = null; + + this.worldTransform = null; + this.filterArea = null; + + this.listeners = null; +}; diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index 3d544d9..7fa2218 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -93,27 +93,6 @@ this.texture = texture || Texture.EMPTY; } -/** - * Destroys this sprite and optionally its texture - * - * @param destroyTexture {boolean} Should it destroy the current texture of the sprite as well - * @param destroyBaseTexture {boolean} Should it destroy the base texture of the sprite as well - */ -Sprite.prototype.destroy = function (destroyTexture, destroyBaseTexture) -{ - Container.prototype.destroy.call(this); - - this.anchor = null; - - if (destroyTexture) - { - this._texture.destroy(destroyBaseTexture); - } - - this._texture = null; - this.shader = null; -}; - // constructor Sprite.prototype = Object.create(Container.prototype); Sprite.prototype.constructor = Sprite; @@ -504,6 +483,27 @@ } }; +/** + * Destroys this sprite and optionally its texture + * + * @param destroyTexture {boolean} Should it destroy the current texture of the sprite as well + * @param destroyBaseTexture {boolean} Should it destroy the base texture of the sprite as well + */ +Sprite.prototype.destroy = function (destroyTexture, destroyBaseTexture) +{ + Container.prototype.destroy.call(this); + + this.anchor = null; + + if (destroyTexture) + { + this._texture.destroy(destroyBaseTexture); + } + + this._texture = null; + this.shader = null; +}; + // some helper functions.. /**