Copy link to clipboard
Copied
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!
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);
});
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
}
Copy link to clipboard
Copied
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);
});