How to click a drawing drawn from code(HTML5)

Enthusiast ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

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----")}); 
}
};

 

Views

75

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

Hi.

 

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

I'm practicing.

I want the code to generate everything.

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

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

I think that's a "No."

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 29, 2020 Dec 29, 2020

Copy link to clipboard

Copied

LATEST

I found and rewritten 1 code(Insert (body label))。

But this code cannot be inserted into the “stage”。

If I can insert it into the stage (canvas), that's what I want to do

 

 

var uvw=function(){
var x="hi.", b;
(b = document.createElement("button")).innerHTML = "click me,This is the button";
b.setAttribute("onclick", "alert('"+x+"')");
document.body.appendChild(b);
}

uvw()

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines