views:

46

answers:

2

Hi I have the following files: model.as clint.mxml

in clint.mxml I have the following line:

<s:Group id='clint1' x="model.locationX">
...

in the model.as I have a getter:

[bindable(event="locationXChanged"))
function get locationX () : int {
   return ...
}

My problem is that I need to know within the getter locationX that the id of the object that is getting the id is clint1 (The object id in the mxml).

+1  A: 

The result of a getter should not depend on which object it is called from. I guess your getter should not be a getter and should maybe take a clintId as argument.

David
A: 

You can use this to refer to the current component. You can use 'this.id' to find out the component's name. More info on id property.

However, I'm getting mixed signals from your question and the question's title. Are you asking for the id of the binding target inside the binding source? Implementing that would add dependencies to your components thus harming their ability for reuse.

www.Flextras.com
It looks like he's asking for a way to access the clintid from the getter that belongs to the model. Obviously, calling this.id inside the getter won't return clint's id.
David
The original post says the getter is inside the clint.mxml file, so 'this'id' inside the getter will return the id for the current instance of 'clint'. But, will not return the id of other instance of clint.
www.Flextras.com