You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var group = new Phaser.Group();
group.iterate('name', 'test', Phaser.Group.RETURN_NONE, function(item) {})
The above code fails with the message:
Uncaught TypeError: Cannot set property '0' of undefined
The Problem
Line 1468 of the Phaser.Group file is causing the problem. This line reads:
args[0] = this.children[i];
The problem is that the args argument is not initialized anywhere inside the iterate method before that call.
Possible Solutions
For me it would be enough a relevant description of the args parameter to be added in the documentation where it would be mentioned that when a callback is set, then a value for the args parameter should be set as well.
The text was updated successfully, but these errors were encountered:
pnstickne
added a commit
to pnstickne/phaser
that referenced
this issue
Nov 22, 2014
Update iterate documentation to cover usage of `args` and added a guard so
that the callback can be used without requiring that `args` is specified.
Ref. phaserjs#1352
Example
The above code fails with the message:
The Problem
Line 1468 of the Phaser.Group file is causing the problem. This line reads:
The problem is that the
args
argument is not initialized anywhere inside theiterate
method before that call.Possible Solutions
For me it would be enough a relevant description of the
args
parameter to be added in the documentation where it would be mentioned that when acallback
is set, then a value for theargs
parameter should be set as well.The text was updated successfully, but these errors were encountered: