Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Open MovieClip over mouse position

Explorer ,
Jul 28, 2020 Jul 28, 2020

Copy link to clipboard

Copied

Снимок экрана 2020-07-28 в 16.55.06.png

Hello, guys! The task. I have movieclip panel_PA_anim, which has eventListener. I would like to open another MC and put it over mouse. How should I adjust my code to fix it?

 

this.panel_PA_anim.addEventListener("click", (e) => {

let l = this.globalToLocal(stage.mouseX, stage.mouseY);

Object(this.parent).incorrect.x = l.x;
Object(this.parent).incorrect.y = l.y;

Object(this.parent).incorrect.visible = true;
let a = () => {
Object(this.parent).incorrect.visible = false
}
setTimeout((a), 700);

});

 

 

Thank you in advance!

Views

86

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

correct answers 1 Correct answer

Explorer , Jul 29, 2020 Jul 29, 2020
Hi, mate!I've found that this code works, but clips should be at the same stage (in the same coordinate system). this.incorrect_PA.visible = false; this.panel_PA_anim.addEventListener("click", (e) => { let l = this.globalToLocal(stage.mouseX, stage.mouseY); this.incorrect_PA.x = l.x; this.incorrect_PA.y = l.y this.incorrect_PA.visible = true; let a = () => { this.incorrect_PA.visible = false } setTimeout((a), 700); });

Likes

Translate

Translate
Adobe Community Professional ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

if that code actually compiles, you need to explain what you're doing.  if that code was copied from somewhere unrelated to animate, and incorrect and panel_PA_anim are both children of the same movieclip that contains your code, use:

 

this.panel_PA_anim.addEventListener("click", f.bind(this));

var to;

function f(){

var l = this.globalToLocal(stage.mouseX, stage.mouseY);

this.incorrect.x = l.x;
this.incorrect.y = l.y;

this.incorrect.visible = true;
clearTimeout(to);
to=setTimeout(a, 700, this);

};

function a(tl){

tl.incorrect.visible = false

}

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
Explorer ,
Jul 29, 2020 Jul 29, 2020

Copy link to clipboard

Copied

LATEST

Hi, mate!

I've found that this code works, but clips should be at the same stage (in the same coordinate system).

 

this.incorrect_PA.visible = false;

this.panel_PA_anim.addEventListener("click", (e) => {
	
	let l = this.globalToLocal(stage.mouseX, stage.mouseY);
	
	this.incorrect_PA.x = l.x;
	this.incorrect_PA.y = l.y
	
	this.incorrect_PA.visible = true;
	let a = () => {
		this.incorrect_PA.visible = false
	}
	setTimeout((a), 700);
	
});

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