Copy link to clipboard
Copied
Cordial saludo:
Necesito modificar una serie de símbolos usando javascript. Para ello hago una iteración y mi idea era según el nombre del símbolo asignarle determinados comportamientos. El problema es que todos los elementos en animate tienen el atributo "name" como null.
¿Hay alguna forma de asignar un valor al atributo name desde Animate para después leerlo en javascript?
Best regard:
I need to modify a series of symbols using javascript. To do this I do an iteration and my idea was to assign certain behaviors depending on the name of the symbol. The problem is that all the elements in animate have the "name" attribute as null.
Is there a way to assign a value to the name attribute from Animate and then read it in javascript?
you can assign a name property in the properties panel, if the object is on-stage during design. you can also assign a name using javascript.
you can also use the object's linkage id or class name if you're assigning those.
Copy link to clipboard
Copied
you can assign a name property in the properties panel, if the object is on-stage during design. you can also assign a name using javascript.
you can also use the object's linkage id or class name if you're assigning those.
Copy link to clipboard
Copied
Thanks for your answer.
I create it with a name during design, but when opening it in javascript the name attribute is null. I see people asking the same thing since 2019 and no answer. Adding it with javascript is easy, but it doesn't work for me. What I need is to tell Javascript what the object was called when styling it.
for example, in that image I create a symbol with the name "s1", but in javascript the name attribute is null.
Copy link to clipboard
Copied
You're right, I already found it.
The name of the symbol is not the same as the name of the instance.
Copy link to clipboard
Copied
correct. symbols mean the library symbols which have no name property.
library symbols can have a linkage id and/or class name and be referable by javascript during code execution, and then have names assigned by javascript.
instances are objects placed on stage during design and they can have names assigned (like s1 that you showed) and they then have a defined name property referable by javascript.