CanvasScript3
>
Tests
> MouseEvent - MouseUp
Code
var stage = new Stage("canvas", 420, 500, 30); stage.name = "stage"; var red = new Sprite(); red.name = "red"; red.x = 200; red.y = 200; red.graphics.lineStyle(0); red.graphics.beginFill(0xFF0000); red.graphics.drawCircle(0, 0, 180); red.graphics.endFill(); red.addEventListener(MouseEvent.MOUSE_UP, function(e) { trace('type=' + e.type + ', target=' + e.target.name + ", currentTarget=" + e.currentTarget.name); }); stage.addChild(red); var blue = new Sprite(); blue.name = "blue"; blue.x = 0; blue.y = 0; blue.graphics.lineStyle(0); blue.graphics.beginFill(0x0000FF); blue.graphics.drawCircle(0, 0, 130); blue.graphics.endFill(); blue.addEventListener(MouseEvent.MOUSE_UP, function(e) { trace('type=' + e.type + ', target=' + e.target.name + ", currentTarget=" + e.currentTarget.name); }); red.addChild(blue); var green = new Sprite(); green.name = "green"; green.x = 0; green.y = 0; green.graphics.lineStyle(0); green.graphics.beginFill(0x00FF00); green.graphics.drawCircle(0, 0, 80); green.graphics.endFill(); green.addEventListener(MouseEvent.MOUSE_UP, function(e) { trace('type=' + e.type + ', target=' + e.target.name + ", currentTarget=" + e.currentTarget.name); }); blue.addChild(green); stage.addEventListener(MouseEvent.MOUSE_UP, function(e) { trace('type=' + e.type + ', target=' + e.target.name + ", currentTarget=" + e.currentTarget.name); });
Canvas
Output