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

HTML5 Canvas - Nested button to move parent

Engaged ,
Feb 20, 2022 Feb 20, 2022

Copy link to clipboard

Copied

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

Views

130

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

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

Votes

Translate

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

Thanks JC, that did the trick!

 

Peter

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
Community Expert ,
Feb 21, 2022 Feb 21, 2022

Copy link to clipboard

Copied

LATEST

Awesome!

 

You're welcome!

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