Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Uncaught TypeError: Cannot redefine property: defineProperty fastFourierTransform" when create SoundAnalyseSprite after destroying another one. #1

Open
elsemieni opened this issue Oct 31, 2016 · 0 comments

Comments

@elsemieni
Copy link

elsemieni commented Oct 31, 2016

This is example code

this.viz = analysePlugin.add.soundAnalyseSprite(
            0, 0, this.game.width, this.game.height, "_AUDIO", true, function(){
                        //blahblah
 }, this);

After sound complete playing, I destroy it using:

this.viz.destroy();

When I creating it again, browser throws me this error (Tested in Chrome based browsers, Phaser 2.6.2 ):

Uncaught TypeError: Cannot redefine property: defineProperty fastFourierTransform"

I take a peek in the code, and I saw some methods in SoundAnalyser are created with Object.defineProperty function. I bypassed this error in my project just putting in a condition if Phaser.SoundAnalyser.prototype already exists in each of defineProperty, but I think that's not a good solution (I'm not an expert of JS, sorry xD).

Thanks for advance, oh, and thanks for this great plugin. :)

P.S. Also, I checked twice if I'm not re-adding the plugin in-the-fly more than once. It's just loaded at boot time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant