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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.