Referring to the identifier of the component, output the variable

I am developing a flexible application and I want to access the component using its id. I know I have to use the .property component. The problem is that I have the component identifier in the String variable, and now I do not know how to access its properties. Does anyone know what I should do?

+3
source share
2 answers

If you set the string variable equal to the identifier of the component, you will not be able to access any properties, because now it is a string, not an object. How do you set a string variable? You need to access the component itself, and setting the identifier to the string will fail. You should set the property using the object itself, not a string representation of its identifier. Paste your code if you want me to take a look.

To set the component property itself, the syntax is myComponent.myProperty = myValue

To get the value myValue = myComponent.myProperty

+1
source

In actionscript you can do something like this [$ var] .property i believe

+1
source

Source: https://habr.com/ru/post/1717068/


All Articles