actionscript 3 - dispatch mouse out event when the mouse not out -
i created tooltip class. when mouse on over movieclip enable , when out disable. movieclip containt other movieclips. code that:
to.addeventlistener(mouseevent.mouse_over, showtip); to.addeventlistener(mouseevent.mouse_out, hidetip); to.addeventlistener(mouseevent.mouse_move, movetip);
and functions that:
private function showtip(evt: mouseevent) { if (tip != null && !tip.visible) { tip.x = evt.stagex; tip.y = evt.stagey; tip.visible = true; } } private function hidetip(evt: mouseevent) { if (tip != null && tip.visible) { tip.visible = false; } } private function movetip(evt: mouseevent) { if (tip != null && tip.visible) { tip.x = evt.stagex; tip.y = evt.stagey; } }
its work hidetip function , showtip function enable in same time , tip flashing.
apparently tooltip obscures underlying to
movieclip, making flash think mouse out of to
mc, triggering mouse out listener. possible solution shifting tip
off mouse cursor instead of displaying right on top of mouse position.
const offsetx:number=4; const offsety:number=4; // experiment these private function showtip(evt: mouseevent) { if (tip != null && !tip.visible) { tip.x = evt.stagex+offsetx; tip.y = evt.stagey+offsety; tip.visible = true; } } private function movetip(evt: mouseevent) { if (tip != null && tip.visible) { tip.x = evt.stagex+offsetx; tip.y = evt.stagey+offsety; } }
Comments
Post a Comment