topical media & game development

talk show tell print

mobile-graphic-easel-tutorials-Mouse-Interaction-basic.htm / htm



  <!DOCTYPE html>
  <html>
  <head>
          <title>EaselJS demo: onClick</title>
          <link href="../shared/demo.css" rel="stylesheet" type="text/css">
          <script src="../../lib/easeljs-0.6.0.min.js"></script>
          <script>
                  function init() {
                          var stage = new createjs.Stage("demoCanvas");
                          
                          var circle = new createjs.Shape();
                          circle.graphics.beginFill("red").drawCircle(0, 0, 50);
                          circle.x = 100;
                          circle.y = 100;
                          
                          circle.addEventListener("click", function() {
                                  alert("clicked");
                          });
                          
                          stage.addChild(circle);
                          stage.update();
                  }
          </script>
  </head>
  <body onLoad="init();">
          <canvas id="demoCanvas" width="500" height="200">
                  alternate content
          </canvas>
  </body>
  </html>


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.