Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I got a 2d-overlay with a click event that works properly, it initiates a dragging function. but now i want it to loose focus & stop dragging when my mouse leaves the 2d-overlay surface until it got clicked again. how do i do that ?? |
||||
|
You can simply check if the mouse is inside the overlay position or not by getting screen resolution and mouse position and overlay position and scale and then comparing them. You can use my code below if you want, just insert your dragging function, and your overlay node wherever necessary. I could have made it easy for you by creating a simple variable for overlay nodes and then inserting them everywhere but I want you to do some stuff on your own as well. so just replace the bold text along with your own preferences.
hope this helps |
||||
|
I looked a bit better in the manual after your nice and elaborate answer, Thank You for that. !!! and found these event type function handlers ? (not shure about correct terminology) myaction.prototype.execute = function() {} myaction.prototype.onAnimate = function() {} myaction.prototype.onKeyEvent = function() {} myaction.prototype.onMouseEvent = function() {} so I will need a mouseNOTover type of event handler so will work out this with you kindly provided snippet.with : myaction.prototype.onMouseEvent = function() {} but it surprises me there is not more of these event handler functions. mouse over or not over must be there in the sdk else how would the out of the box color animation function work ? this SDK solution would be much faster also, as being implemented in C. |
||||
|
Actually this will also not work for android , its intended platform as there is no mouse but only touch events and the manual says nothing how to handle that ... hmmm |
|