bitmap - My addEventListener does not work on Easeljs -
i have started easeljs , want call function when click on bitmap. have done withous success:
we told me cross-domain image issue don't know is... code:
<!doctype html> <html> <head> <title>test</title> <script src="easeljs-0.8.0\lib\easeljs-0.8.0.combined.js"></script> <script> var moncanvas; var scene; var monimage; var monbitmap; function init() { moncanvas = document.getelementbyid("mon_canvas"); scene=new createjs.stage(moncanvas); monimage=new image(); monimage.src="smiley.png"; monimage.onload=creationbitmap; createjs.ticker.useraf=true; createjs.ticker.setfps(40); createjs.ticker.addeventlistener("tick", tick); } function creationbitmap() { monbitmap=new createjs.bitmap(monimage); monbitmap.x=200; monbitmap.y=70; monbitmap.regx=20; monbitmap.regy=20; monbitmap.addeventlistener("click", clicksouris) scene.addchild(monbitmap); scene.update(); } function clicksouris() { alert("some text"); } window.onload=init; </script> </head> <body> <canvas id="mon_canvas" width="1000px" height="600px" style="border : 1px solid"></canvas> </body> </html>
Comments
Post a Comment