Skip to main content
November 26, 2010
Answered

how to to get Object's property by it's String name

  • November 26, 2010
  • 1 reply
  • 641 views

Hello everyone!

There is a function that receiving value of String = 'propertyName', wich is property name.

and i have an Object item with property of name equals to 'propertyName'.

How do i get item's value of that property?

I know that

ObjectUtil.getClassInfo(item).properties

returns an Array of item's properties, but is it an easier way to get it instead of searching trough Array?

Thanks in advance, Alex.

This topic has been closed for replies.
Correct answer kglad

from your object's parent timeline:

var yourObject:DisplayObject = getChildByName("propertyName");

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 26, 2010

from your object's parent timeline:

var yourObject:DisplayObject = getChildByName("propertyName");

November 26, 2010

getChildByName somehow didn' work for me, but of course i don't doubt of it's true.

i just fixed this a minute ago with item[propertyName], excuse me :-)

Thank you  very much!

kglad
Community Expert
Community Expert
November 26, 2010

you're welcome.