Re-arranged methods and added parent.

This commit is contained in:
Richard Davey 2016-09-29 03:10:16 +01:00
parent 043efb759c
commit 0aa6650422

View file

@ -9,7 +9,9 @@
*
* @class
*/
Phaser.Component.Children = function () {
Phaser.Component.Children = function (parent) {
this.parent = parent;
// The objects that belong to this collection.
// The equivalent of the old `Sprite.children` array.
@ -193,8 +195,6 @@ Phaser.Component.Children.prototype = {
},
swap: function (child1, child2) {
if (child1 === child2)
@ -215,7 +215,6 @@ Phaser.Component.Children.prototype = {
},
// was setIndex
moveTo: function (child, index) {
@ -295,6 +294,24 @@ Phaser.Component.Children.prototype = {
},
/**
* Removes all the items.
*
* @method Phaser.ArraySet#removeAll
*/
removeAll: function () {
var i = this.list.length;
while (i--)
{
this.remove(this.list[i]);
}
return this;
},
// Check to see if the given child is a child of this object, at any depth (recursively scans up the tree)
contains: function (child) {
@ -499,24 +516,6 @@ Phaser.Component.Children.prototype = {
},
/**
* Removes all the items.
*
* @method Phaser.ArraySet#reset
*/
reset: function () {
var i = this.list.length;
while (i--)
{
this.remove(this.list[i]);
}
return this;
},
/**
* Sets the property `key` to the given value on all members of this list.
*