naveen Posted July 23, 2014 Share Posted July 23, 2014 I am using below code, game.input.onUp.add(function() { }, this); Is any other way to do? Link to comment Share on other sites More sharing options...
lewster32 Posted July 23, 2014 Share Posted July 23, 2014 You need to use Mouse.mouseOutCallback:game.input.mouse.mouseOutCallback = function() { console.log("Mouse left game canvas");}; Link to comment Share on other sites More sharing options...
naveen Posted July 23, 2014 Author Share Posted July 23, 2014 thank you. It is working. lewster32 1 Link to comment Share on other sites More sharing options...
kleepklep Posted August 7, 2015 Share Posted August 7, 2015 The mouseOutCallback code works, but the question about firing the onInputUp listener was never answered. I'm guessing that Naveen was trying to figure out a workaround for browsers like IE11 that do not detect if the user releases the mouse outside of the canvas. One way to deal with that would be to automatically trigger a mouse up event when leaving the canvas to avoid the complications that arise if a user releases the mouse outside the canvas and the event is not detected.If I do this by calling the function specified in onInputUp, my onInputDown listener only responds on the second mouse down. Is there a way to trigger onInputUp without actually releasing the mouse? car.events.onInputDown.add(onGrabCar, this);car.events.onInputUp.add(onReleaseCar, this);game.input.mouse.mouseOutCallback = function() { console.log("Mouse left game canvas"); onReleaseCar();//have to click twice to grab again};See related post http://www.html5gamedevs.com/topic/16304-sprites-oninputup-doesnt-fire-if-off-canvas-in-ie11-is-there-a-fix/ Link to comment Share on other sites More sharing options...
Recommended Posts