Hide a single element in a layer - Kineticjs -


this code uses kineticjs. using mouseover , mouseout events 1 of images. layer has 2 images. want hide 1 of them. need create separate layer each image?

img.onload = function(){                     var image = new kinetic.image({                         image: img,                         name:'iconimage',                         width: 50,                         height: 50,                         //draggable: true,                         //visible:true,                         listening:true                     });                     var image2 = new kinetic.image({                         x:100,                         y:100,                         image: img,                         name:'iconimage',                         width: 50,                         height: 50,                         //draggable: true,                         //visible:true,                         listening:true                     });                 iconlayer.add(image).add(image2);                 stage.add(iconlayer);                 //stage.draw();                   image.on('mouseover',function(){                     image.hide();                      iconlayer.clear();                     //iconlayer.draw();                  });                  image.on('mouseout',function(){                     //iconlayer.clear();                     //image.show();                     //iconlayer.draw();                      image.show();                     iconlayer.draw();                      //stage.draw();                 });                  } 

which best way use hide() , show() functions?

you don't need separate layer.

just use myshape.hide() , myshape.show()


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -