The onFrame
and onResize
events are specific to the view
object. If you're calling them from inside an onMouseEnter
event handler of a path object, it may fire, but the event will still come from onMouseEnter
. I recommend calling:
console.log(event);
instead of "test" to get a clearer picture of what is being returned.
Instead, you'll need to attach an event handler to your object that attaches another event handler to the view.
var path = new Path.Circle({
center: view.center,
radius: 25,
fillColor: 'black'
});
var shiftPath = function onFrame(event) {
console.log(event.count);
path.position += new Point(.5,.5);
};
path.on('mouseenter', function(){view.on('frame', shiftPath)});
path.on('mouseleave', function(){view.off('frame', shiftPath)});
You can attach multiple event handlers to an object and/or the view in this way. Check out this answer for another example.