Rocco Posted May 8, 2014 Share Posted May 8, 2014 i don't know what i overlooked here: this works: var lbl_ease_1 = this.add.text(x_val, y_val, score, easing_style); var tween = this.add.tween(lbl_ease_1).delay(100).to({y: lbl_ease_1.y-100}, 1000, Phaser.Easing.Linear.None).start(); lbl_ease_1.destroy(); but with onComplete it doesn't: var lbl_ease_1 = this.add.text(x_val, y_val, score, easing_style); var tween = this.add.tween(lbl_ease_1).delay(100).to({y: lbl_ease_1.y-100}, 1000, Phaser.Easing.Linear.None).start(); tween.onComplete.add(lbl_ease_1.destroy, this); i get Uncaught TypeError: Cannot read property 'destroy' of undefined thanks for giving me an idea what is wrong here. Link to comment Share on other sites More sharing options...
Kapsonfire Posted May 8, 2014 Share Posted May 8, 2014 try to call it in an anonymous functiontween.onComplete.add(function() {lbl_ease_1.destroy();}, this); Rocco 1 Link to comment Share on other sites More sharing options...
Rocco Posted May 8, 2014 Author Share Posted May 8, 2014 yeap it works with your approach.thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts