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

126
Vistas
Set button state - Create.js/Easel.js

In Adobe Animate HTML5 Canvas (Create.js/Easel.js), I am trying to set the state of a button, but not working with various code:

this.retinoscopeButton.addEventListener("click", retinoscope.bind(this));

/*function retinoscope(evt) {
    var retinoscopeButtonState = evt.currentTarget.state = !evt.currentTarget.state;
    if (retinoscopeButtonState) {
        alert(retinoscopeButtonState);
        this.retinoscopeButton.upState = this.retinoscopeButton.downState;
    } else {
        this.retinoscopeButton.downState = this.retinoscopeButton.upState;
    }
}*/

var retinoscopeButtonState = 'up';

function retinoscope(evt){ 
    if (retinoscopeButtonState == 'up'){
    this.retinoscopeButton.upState = this.retinoscopeButton.downState;
        retinoscopeButtonState = 'down';
    } else if (retinoscopeButtonState == 'down'){
    this.retinoscopeButton.downState = this.retinoscopeButton.upState;
        retinoscopeButtonState = 'up';
    }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This works for me...

Note that this is using a MovieClip with three keyframes for the different 'states' in the button MC retinoscopeButton

var toggle;

if (!root.retinoscopeButton.hasEventListener("click")) {
    toggle = false;
    root.retinoscopeButton.addEventListener("click", retinoscopeButtonClickHandler.bind(this));
}


root.retinoscopeButton.addEventListener("mouseover", retinoscopeButtonRollOverHandler.bind(this));
root.retinoscopeButton.addEventListener("mouseout", retinoscopeButtonRollOutHandler.bind(this));


function retinoscopeButtonClickHandler() {
    if (toggle == false) {
        root.retinoscopeButton.gotoAndStop(2);
        toggle = true;
    } else if (toggle == true) {
        root.retinoscopeButton.gotoAndStop(0);
        toggle = false
    }
}

function retinoscopeButtonRollOverHandler() {
    if (toggle == false) {
        root.retinoscopeButton.gotoAndStop(1);
    }
}

function retinoscopeButtonRollOutHandler() {
    if (toggle == false) {
        root.retinoscopeButton.gotoAndStop(0);
    }
}
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