• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Component Parameters Click Image

New Here ,
Jul 07, 2022 Jul 07, 2022

Copy link to clipboard

Copied

How can I make the image clickable?

umut25164787ozwi_0-1657219975197.pngumut25164787ozwi_1-1657220090161.png

not working

umut25164787ozwi_2-1657220136212.png

How can I write code with document.queryselector?

Views

64

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
Community Expert ,
Jul 07, 2022 Jul 07, 2022

Copy link to clipboard

Copied

LATEST

Hi.

 

You could write something like this:

stage.on("drawend", function() // components are not immediately available so we have to listen for the drawend event
{
	var image = document.getElementById("yourComponent"); // "yourComponent" is the instance name of the Image component instance in the Properties panel
	
	image.addEventListener("click", function()
	{
		console.log("clicked");
	});
}, null, true);

 

But do you really need a component for this? Why just don't turn the bitmap into a symbol and add a listener to it?

 

Regards,

JC

Votes

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