Why am I getting the error "event.addEventListener is not a function"?
This is my code in actions for Adobe Animate. There is a symbol instance called container.
var root = this;
var container;
function main()
{
root.stop();
container = root.container;
container.mouseChildren = true;
container.hitArea = new createjs.Shape(new createjs.Graphics().f("#000").dr(0,0,960,540));
container.cache(0,0,960,540);
stage.addChild(container);
container.on("mousedown", mousePressed);
createjs.Ticker.addEventListener("tick", stage);
var drawing = new createjs.Shape();
container.addChild(drawing);
}
var lastPoint = new createjs.Point();
function mousePressed(event)
{
lastPoint.x = event.stageX;
lastPoint.y = event.stageY;
event.addEventListener("mousemove", function(event){
drawing.graphics.ss(20, "round").s("#ff0000");
drawing.graphics.mt(lastPoint.x, lastPoint.y);
drawing.graphics.lt(event.stageX, event.stageY);
lastPoint.x = event.stageX;
lastPoint.y = event.stageY;
var erase = document.getElementById("toggle").checked;
container.updateCache(erase?"destination-out":"source-over");
drawing.graphics.clear();
});
};
main();
