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

¿Cómo se debe programar un botón para que active o desactive una capa en HTML5 Canvas?

Guest
Jan 30, 2018 Jan 30, 2018

Hola.

Estoy iniciando en Adobe Animate, me surge una duda y no he podido encontrar solución.

¿Cómo se debe programar un botón para que active o desactive una capa en HTML5 Canvas?

Muchas gracias.

452
Translate
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 , Jan 31, 2018 Jan 31, 2018

Hi.

You can, for example, access a symbol or layer and toggle its visibility.

var that = this;

// advanced layers off

// you have to create a symbol and toggle its visibility

this.toggleSymbol.addEventListener('click', function() // toggleSymbol is the button's name

{

    that.cover.visible = !that.cover.visible;

});

// OR

// advanced layers on

// when you use advanced layers, Animate turns layers into symbols

this.toggleLayer.addEventListener('click', function() // toggleLayer is the button's name

{

    var

...
Translate
Community Expert ,
Jan 31, 2018 Jan 31, 2018

Hi.

You can, for example, access a symbol or layer and toggle its visibility.

var that = this;

// advanced layers off

// you have to create a symbol and toggle its visibility

this.toggleSymbol.addEventListener('click', function() // toggleSymbol is the button's name

{

    that.cover.visible = !that.cover.visible;

});

// OR

// advanced layers on

// when you use advanced layers, Animate turns layers into symbols

this.toggleLayer.addEventListener('click', function() // toggleLayer is the button's name

{

    var l = that.getChildByName("layer"); // "layer" is the name of the layer you want to change

    l.visible = !l.visible;

});

I hope it helps.

Regards,

JC

Translate
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
Guest
Feb 12, 2018 Feb 12, 2018

Muchas gracias.

Me fue muy util tu ayuda.

Translate
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 12, 2018 Feb 12, 2018
LATEST

De nada, meu amigo!

Translate
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