Draw lines in specific area on stage
I found this answer in the forum, I am looking for the way to draw lines to mark on a specific item. I'm doing a letter-type activity.
var miLinea, origenX, origenY, grosor, color;
miLinea = new createjs.Shape();
stage.on("stagemousemove", function (evt) {
if (origenX) {
miLinea.graphics.beginStroke(color)
.setStrokeStyle(grosor, "round")
.moveTo(origenX, origenY)
.lineTo(evt.stageX, evt.stageY);
stage.update();
}
origenX = evt.stageX;
origenY = evt.stageY;
stage.update();
})
stage.on("stagemousedown", function (event) {
color = createjs.Graphics.getRGB(150, 100, 150, 1);
grosor = 4;
});
stage.on("stagemouseup", function (event) {
color = "";
});
This code works, but usually traces on the stage. I also tried to add buttons and objects by drawing them directly on the stage but these are not shown on the screen.
Is there any way that the code above written allows you to draw lines only in a certain area and not at all the stage?
I continue to learn in a self-taught way, really the help they provide here is very useful.
Greetings.
