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

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

New Here ,
Aug 30, 2022 Aug 30, 2022

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?

Views

114

Translate

Translate

Report

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 , Aug 30, 2022 Aug 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.

Votes

Translate

Translate
Community Expert ,
Aug 30, 2022 Aug 30, 2022

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.

Votes

Translate

Translate

Report

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
New Here ,
Aug 30, 2022 Aug 30, 2022

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.Captura de pantalla 2022-08-30 103933.png

 

for example, in that image I create a symbol with the name "s1", but in javascript the name attribute is null.

 

Captura de pantalla 2022-08-30 104245.png

Votes

Translate

Translate

Report

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
New Here ,
Aug 30, 2022 Aug 30, 2022

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.

Votes

Translate

Translate

Report

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 ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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