Skip to main content
Participant
August 30, 2022
Answered

Asignar valor al atributo "name" de un símbolo (Assign value to the "name" attribute of a symbol)

  • August 30, 2022
  • 1 reply
  • 229 views

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?
    This topic has been closed for replies.
    Correct answer kglad

    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.

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    August 30, 2022

    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.

    Participant
    August 30, 2022

    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.