Jump to content

How to remove onInputDown event from Sprite?


gsko
 Share

Recommended Posts

I've tried to use the destory method but I can' seem to get it to work. Here's my code sample:

tether_drag = game.add.sprite(530, 15, 'drag');tether_drag.name = 'tether_drag';tether_drag.inputEnabled = true;tether_drag.animations.add('pull');tether_drag.events.onInputDown.add(checkInputStatus, {sprite: tether_drag});

I cannot set inputEnabled to false since I still need to be able to track if it is being clicked so I can send an error message. The checkInputStatus will see if the Sprite is active or inactive (i use Sprites health to keep track of active/inactive) and do that case. This is the code that fires if the Sprite is inactive:

tether_drag.events.destory();

and I also tried...

tether_drag.input.reset(true);

But the event keeps firing every time I click the Sprite. How can I stop the event from firing keeping in mind that inputEnabled needs to be set to true.

 

Thanks,

 

gsko

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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