easeljs - mouseout event handler isn't trrigering -
i have unusual behavior in app: have collection of shapes each 1 of them has mouseover , mouseout event handlers. when user moves on shape, color changes , when moves out of it, color returns original color.
the thing don't understand sometimes, mouseout event isn't trigering @ , color of shape remains hovered state.
i seek print console , couldn't find problem. know doesn't enters mouseouse handler
var onmouseover = function (e, sha, container) { if (seat.ishovered) return; $('body').css('cursor', 'pointer'); var curhoveredshape = sha; var newshape = new createjs.shape(); newshape .addeventlistener('mouseout', function (e) { onshapemouseout(e, e.target, e.target.parent); }); newshape .graphics.beginfill(hoverdseatcolor).drawroundrect(0, 0, 5, 5, 1.5); newshape .x = curhoveredseat.x; newshape .y = curhoveredseat.y; newshape .parent = container; sha.removeeventlistener("mouseover", arguments.callee); container.removechild(sha); container.addchild(newshape ); newshape .ishovered = true; lasthoveredseat = newshape ; stage.update(); }
here's code mouseout:
var onmouseout = function (e) { var curshape= e.target; var container = e.target.parent; $('body').css('cursor', 'pointer'); var newshape = new createjs.shape(); newshape.graphics.beginfill(selectedseatcolor).drawroundrect(0, 0, 5, 5, 1.5); newshape.x = curshape.x; newshape.y = curshape.y; newshape.parent = container; curshape.removeeventlistener("mouseout", arguments.callee); container.removechild(curshape); container.addchild(newshape); newshape.ishovered = false; lasthoveredseat = null; newshape.addeventlistener('mouseover', function(e){ onseatmouseover(e, e.target, e.target.parent); }); stage.update(); $(mapmanagerobj).trigger("onseathoveredout"); }
easeljs
No comments:
Post a Comment