Jump to content

Removing Assets Question


Recommended Posts


Good question!

Asset will stay in memory as long as there is reference to it. Changing scene will usually remove all references, so in most situations yes it will stay in memory until you leave scene.

game.createScene('Main', {
    init: function() {
        this.sprite = new game.Sprite('panda.png');
    mousedown: function() {
        // panda.png would still be rendered
        // because there is reference to the texture at
        // this.sprite.texture
    mouseup: function() {
        this.sprite.remove(); // Remove from stage
        this.sprite = null; // Remove reference
        // This would now throw error
        var sprite = new game.Sprite('panda.png');


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...