Skip to main content
chenjil43641795
Legend
December 29, 2020
Question

How to click a drawing drawn from code(HTML5)

  • December 29, 2020
  • 1 reply
  • 367 views

Like what.

I'd like to click on the jiaose pop-up prompt

 

var jiaose = {
name: "gw",
dh: function() {
var shape = new createjs.Shape(new createjs.Graphics().beginFill("#ff0000").drawRect(5, 5, 50, 50));
this.addChild(shape);
this.on("click", function(){alert("ss----")}); 
}
};

 

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    December 29, 2020

    Hi.

     

    Have you tried adding the click listener to the shape instance?

    chenjil43641795
    Legend
    December 29, 2020

    I'm practicing.

    I want the code to generate everything.

    I think I'll execute it with jiaose.dh().

     

    Legend
    December 29, 2020

    I think that's a "No."