stamas47 Posted April 12, 2016 Share Posted April 12, 2016 When tweening the Phaser.World, and adding an onComplete event, the listenerContext does not return itself. What happens instead, is that the world container gets returned. Link to comment Share on other sites More sharing options...
stamas47 Posted April 12, 2016 Author Share Posted April 12, 2016 Forget what I said, the listenerContext is the "this". So my bad. In any case, it would be great if we could get a named return for the context, so as to not have to localize and classifiy the "this" in the callback scope. Example: where "this" is a Minigame class this.game.add.tween(this.game.world).to({ alpha: 0 }, 1000, Phaser.Easing.Circular.Out, true).onComplete.add(function (_world:Phaser.World,_tween:Phaser.Tween,_minigame:Minigame) { _minigame.Destroy(); },this) instead of the current possbile solution this.game.add.tween(this.game.world).to({ alpha: 0 }, 1000, Phaser.Easing.Circular.Out, true).onComplete.add(function () { (_minigame as Minigame).Destroy(); },this) or ( but I dont like this approach, for if I need the context more than once, I would have to write "as" that many times ) this.game.add.tween(this.game.world).to({ alpha: 0 }, 1000, Phaser.Easing.Circular.Out, true).onComplete.add(function () { (this as Minigame).Destroy(); },this) Link to comment Share on other sites More sharing options...
Recommended Posts