Group#forEach()

forEach(callback, callbackContext, checkExists, args)

Call a function on each child in this group.

Additional arguments for the callback can be specified after the checkExists parameter. For example,

Group.forEach(awardBonusGold, this, true, 100, 500)

would invoke awardBonusGold function with the parameters (child, 100, 500).

Note: This check will skip any children which are Groups themselves.

Parameters
Name Type Argument Default Description
callback function

The function that will be called for each applicable child. The child will be passed as the first argument.

callbackContext object

The context in which the function should be called (usually 'this').

checkExists boolean <optional>
false

If set only children matching for which exists is true will be passed to the callback, otherwise all children will be passed.

args any <optional>
<repeatable>
(none)

Additional arguments to pass to the callback function, after the child item.

Source code: core/Group.js (Line 1717)
doc_phaser
2017-02-14 10:51:07
Comments
Leave a Comment

Please login to continue.