Reputation: 473
I'm developing a flex application and I want to access a component by using it's id. I know I must use .property of the component. The problem is I have the component Id in a String var and now I don't know how to access to it's properties. Does anybody know what I have to do?
Upvotes: 3
Views: 374
Reputation: 176
If you set the string variable to equal the component ID, you cannot access any properties, because it is now a string and not an object. How are you setting the string variable? You need to access the component itself and setting the ID to a string will not accomplish this. You must set the property using the object itself, and not a string representation of it's ID. Paste your code if you would like me to take a look.
To set the component property itself the syntax would be myComponent.myProperty = myValue
To retrieve the value myValue = myComponent.myProperty
Upvotes: 1
Reputation: 11
In actionscript you can do something like this[$var].property i believe
Upvotes: 1