Sign in to follow this  

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');


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.