handle mouseover event in createjs? - Javascript Canvas

Javascript examples for Canvas:Mouse

Description

handle mouseover event in createjs?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://code.createjs.com/createjs-2013.02.12.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from   w ww  . j a  v  a  2s .c o  m
function demo() {
    var stage = new createjs.Stage("demoCanvas");
    var circle = new createjs.Shape();
    circle.graphics.beginFill("red").drawCircle(0, 0, 40);
    circle.x = circle.y = 50;
    stage.addChild(circle);
    stage.update();
    stage.enableMouseOver(20);
    circle.addEventListener("mouseover", function() {
       circle.alpha *= .80;
       stage.update();
    });
}
demo();
    }

      </script> 
   </head> 
   <body> 
      <canvas id="demoCanvas" width="500" height="400" style="background-color: black"></canvas>  
   </body>
</html>

Related Tutorials