Skip to content

Phaser/AngularJS and the destroy method #1233

@lludol

Description

@lludol

Hi,

I am making a game with my friend and we have some problems.
We use AngularJS with Phaser.

On a page named "room", with have a button who redirect us to a page named "game".

In the game page, we initialize Phaser in a Factory

// Some code ...
init: function(data) {
     game = new Phaser.Game(width, height, Phaser.AUTO, 'game', { preload: preload, create: create
}

In the game page, there is a "back" button.
If I go to the game page and after that i go to the room page, the Phaser object is not deleted.
After 6 times doing that, there is an error in the console :

Uncaught SyntaxError: Failed to construct 'AudioContext': number of hardware contexts reached maximum (6).

I already tried to use the $destroy event in AngularJS to call the destroy method of Phaser but it doesn't work.
Also, i tried target="_self" in my link but there is still the problem.

Do you know how to solve this problem ?

Thank you in advance for your answers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions