Jump to content

destroying text element after tween.onComplete doesn't work


Rocco
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...