Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
how to access the currentTarget movie clip from a button click

I need help with JavaScript in Adobe AnimateCC:

I have two different movie clips and a button. I would like to be able to click on a movie clip (making it the currentTarget) and then click on a button which calls the currentTarget (the just-clicked-on movie clip) and makes it do something -- move 500 px along x for example. Here's my code so far. Any help will be greatly appreciated.

this.grayPentagon_1_mc.addEventListener("click", clickSomePentagon.bind(this));
this.grayPentagon_2_mc.addEventListener("click", clickSomePentagon.bind(this));

function clickSomePentagon(e)
{
    alert(e.currentTarget);
    var myPentagon = e.currentTarget;
}

this.red_btn_1.addEventListener("click", makeSomePentagonMove.bind(this));

function makeSomePentagonMove()
{
    alert("move my pentagon");
    myPentagon.x = 500; 
}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

My bad, I apologize. I should have declared the variable var myPentagon outside the function clickSomePentagon, then referenced the declared variable in the function, like this, which works.

var myPentagon;

this.grayPentagon_1_mc.addEventListener("click", clickSomePentagon);
this.grayPentagon_2_mc.addEventListener("click", clickSomePentagon);

function clickSomePentagon(e)
{
    //alert(e.currentTarget);
    myPentagon = e.currentTarget;
}

this.red_btn_1.addEventListener("click", makeSomePentagonMove.bind(this));

function makeSomePentagonMove()
{
    //alert("move my pentagon");
    myPentagon.x = 500; 
}

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda