Group#setProperty()

setProperty(child, key, value, operation, force) → {boolean}

Sets a property to the given value on the child. The operation parameter controls how the value is set.

The operations are:

  • 0: set the existing value to the given value; if force is true a new property will be created if needed
  • 1: will add the given value to the value already present.
  • 2: will subtract the given value from the value already present.
  • 3: will multiply the value already present by the given value.
  • 4: will divide the value already present by the given value.
Parameters
Name Type Argument Default Description
child any

The child to set the property value on.

key array

An array of strings that make up the property that will be set.

value any

The value that will be set.

operation integer <optional>
0

Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.

force boolean <optional>
false

If force is true then the property will be set on the child regardless if it already exists or not. If false and the property doesn't exist, nothing will be set.

Returns
boolean -

True if the property was set, false if not.

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

Please login to continue.