KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

Dynamically set path mouse functions

Open Gouvi opened this issue 9 years ago • 0 comments

More of a question, apologies for not directing it in the correct forum, this repo is active and hopefully someone can help me. I am looking at setting multiple mouse callbacks.

for (var i = 0; i < somelength; i++) {
    path[i].on('mouseover', function() {//dostuff});
    path[i].on('mouseout', function() {//dostuff});
    path[i].on('mousedown', function() {//dostuff});
}

Just getting a TypeError: Cannot read property 'of' undefined. Manually setting the callback works fine.

path[0].on('mouseover', function() {//dostuff});

Path is simply a global array, I am setting each array element to a new Kinetic path:

path[i] = new Kinetic.Path({etc.});

Any help would be much appreciated.

Gouvi avatar Oct 15 '14 16:10 Gouvi