setCapture()
When an element has mouse capture all mouse events are routed through that element.
Syntax
behavior.setCapture(element);
Example
var mybehavior = jsb.behavior.extend({
onmousedown: function(element, event, x, y) {
this.beginDrag(element, x, y);
event.preventDefault();
},
beginDrag: function(element, x, y) {
this.setCapture(element);
this._dragX = x;
this._dragY = y;
}
});
Notes
Use the releaseCapture() method to release mouse capture.
You will typically release capture on a mouseup event.