gsko

How to remove onInputDown event from Sprite?

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.