I'm having trouble following this because I don't understand why your
getter for itemLocation doesn't return what the setter set.

 

But, setting that aside, I suspect your binding problem is because your
setter isn't dispatching a binding event.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of fb6668
Sent: Monday, June 16, 2008 10:25 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] 'Pointer' in actionscript?

 

Hi.
I have a custom component which uses data from my modellocator.
Depending on the way this component is called depends where abouts
this data comes from,

ie:

private var _itemLocation:Object;
[Bindable]
protected function get itemLocation():Object
{
if(isAssets)
_itemLocation = model.factfind.assets;
else 
_itemLocation = model.factfind.liabilities;

return _itemLocation;
}

protected function set itemLocation(value:Object):void
{
_itemLocation = value;
}

model.factfind.assets and model.factfind.liabilities are both
ArrayCollections.

then, later on, I have 

<mx:Label text="{itemLocation.selectedAssets.getItemAt(0).name}"/>

Now, this doesn't update as I'd expect when the first item in
itemLocation.selectedAssets changes (whatever itemLocation refers to)

If I change it to 
<mx:Label
text="{model.factfind.assets.selectedAssets.getItemAt(0).name}"/>
it works perfectly.

So it seems that when I do the set/get on itemLocation, it copies the
value of model.factfind.assets/liabilities rather than acting as a
"pointer" to that.

How do I get it to work like a pointer so when model.factfind.assets
changes, so does itemLocation, in order that I can use the same
component for both assets and liabilities?

Thanks

 

Reply via email to