Jump to content

Search the Community

Showing results for tags 'removeBetween'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. Hi, When I using the Group.removeBetween(startIndex) to remove children from startIndex to the end of the Group, it always throws Uncaught TypeError: Cannot read property 'events' of undefined.It seems that the implemention of default endIndex is bugged? : Group.js#line-1580 if (typeof endIndex === 'undefined') { endIndex = this.children.length; } Group.js#line-1594 var i = endIndex;while (i >= startIndex){ //The first children[i] is out of bounds? if (!silent && this.children[i].events) { this.children[i].events.onRemovedFromGroup.dispatch(this.children[i], this); } var removed = this.removeChild(this.children[i]);
  2. It is very awkward to say this, but for me it looks like current implementation of this function is bugged. Probably no one uses it anyway or it would be long found The thing is that the code falls in a very trivial trap: it changes the array it is iterating over: for (var i = startIndex; i < endIndex; i++) { if (this.children[i].events) { this.children[i].events.onRemovedFromGroup.dispatch(this.children[i], this); } this.removeChild(this.children[i]); if (this.cursor === this.children[i]) { this.cursor = null; } }removeChild line will shift the indexes, if I'm not mistaken. Eventually the loop fails on accessing .events for non-existant (out of bounds) child. Also it seems reasonable to make second parameter optional, just removing every item starting with startIndex.
×
×
  • Create New...