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

HTML5 Canvas - Nested button to move parent

Engaged ,
Feb 20, 2022 Feb 20, 2022

I have a graphic symbol which contains a nested button.  When clicked, I want that button to move the parent graphic symbol to a location X Y.

 

This is not working, though the nested button gets it's pointer cursor.

 

this.closeLens.addEventListener("click", closeThisLens.bind(this));

function closeThisLens()
{
	this.parent.x = -200;
	this.parent.y = -850;
}
229
Translate
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

correct answers 1 Correct answer

Community Expert , Feb 20, 2022 Feb 20, 2022

Hi.

 

Is the code located inside of the Graphic symbol? Because actions don't run on the timelines of Graphic symbols. You need to convert your Graphic to Movie Clip and replace this.parent in the code by this only because you want to move the Graphic instance itself and not its parent.

 

Regards,

JC

Translate
Community Expert ,
Feb 20, 2022 Feb 20, 2022

Hi.

 

Is the code located inside of the Graphic symbol? Because actions don't run on the timelines of Graphic symbols. You need to convert your Graphic to Movie Clip and replace this.parent in the code by this only because you want to move the Graphic instance itself and not its parent.

 

Regards,

JC

Translate
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
Engaged ,
Feb 20, 2022 Feb 20, 2022

Thanks JC, that did the trick!

 

Peter

Translate
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 ,
Feb 21, 2022 Feb 21, 2022
LATEST

Awesome!

 

You're welcome!

Translate
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