Re: [flexcoders] Re: Deep binding with Cairngorm question

2007-10-31 Thread shaun
Hi, This is not really directly related to Cairngorm, its about design. Disclaimer: The following is just an opinion. I'm not claiming to be a design expert. dbronk wrote: > The problem with this solution is that it is assuming that the same > class that is setting the prodList is also listening

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-31 Thread dbronk
The problem with this solution is that it is assuming that the same class that is setting the prodList is also listening to it. Or at least it knows all of the places that it is listening to it. I may have several different classes listening to this list and each binding to a different function.

Re: [flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread shaun
Hi, dbronk wrote: >>Probably the easiest thing to do would be to make the listener > > reference > >>weak. Or, create an accessor function for the arraycollection and > > remove > >>the listener from the old arraycollection and add a listener to the new >>arraycollection if they are not the

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread dbronk
I guess I'm just not following. I added the following to my ModelLocator [Bindable(event="entriesChanged")] public function get prodList() : ArrayCollection { return _prodList; } public function set prodList(list:ArrayCollection) : void { if ( list == null ) { _prodList.removeAll(); } else { //

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread Dennis van Nooij
I've created an add-on to Alex Uhlman observe tag (http://weblogs.macromedia.com/auhlmann/archives/2006/09/using_binding_s.cfm) that not only monitors the settings of a collection but also tracks changes in it. package com.adobe.ac { import mx.events.CollectionEvent; import flash.e

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread yossigordin
Hi Dale, I just read this thread and i have a better simpler solution. Instead of binding the ArrayCollection, bind the getter. [Bindable(event="entriesChanged")] public function get prodList() : ArrayCollection { return _prodList; } After that just fire the event from every function that adds/r

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread yossigordin
Hi Dale, I just read the entire conversation, and i have a better simpler solution. Instead of binding the arrayCollectiopn in your modelLocator, bind the getter. [Bindable(event="entriesChanged")] public function get prodList() : ArrayCollection { return _prodList; } After that in ea

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-30 Thread dbronk
> Probably the easiest thing to do would be to make the listener reference > weak. Or, create an accessor function for the arraycollection and remove > the listener from the old arraycollection and add a listener to the new > arraycollection if they are not the same object. Will you expand on t

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-29 Thread dbronk
Well, Java takes care of it for you just fine with it's gc. But I realize its not fair to compare against another language, Flex is it's own and makes it's own decisions. But, hasEventListener means I have to check for all types of events individually since there is not a hasAnyEventListener (at

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-29 Thread ben.clinkinbeard
> This seems like a very dangerous design decision by Adobe. I don't know how its really avoidable. I suppose you could argue for automatic cleanup or something but I could see that causing problems as well, and it honestly falls outside the responsibility of a language/runtime IMO. Why can't you

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-29 Thread dbronk
This seems like a very dangerous design decision by Adobe. If somewhere in my application someone as set a listener on an object, and then in another place it is simply reinitialized should NOT cause a memory leak. I'm saying it will not, I'm saying that is a dangerous design for Flex. In this c

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-28 Thread ben.clinkinbeard
I think maybe you're confused about what final is used for. http://livedocs.adobe.com/flex/201/langref/statements.html#final HTH, Ben --- In flexcoders@yahoogroups.com, "arieljake" <[EMAIL PROTECTED]> wrote: > > Could you declare the productList "final" and force future modifiers > to call remo

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-27 Thread arieljake
Could you declare the productList "final" and force future modifiers to call removeAll() instead of creating a new one? --- In flexcoders@yahoogroups.com, "dbronk" <[EMAIL PROTECTED]> wrote: > > Thank you very much and this did help. Thought I'd reply what I found > to work in case you were int

Re: [flexcoders] Re: Deep binding with Cairngorm question

2007-10-27 Thread shaun
Hi, ben.clinkinbeard wrote: > Glad you got it working. Yea, its unfortunate (but unavoidable) that > reinitializing a var kills the listeners. (Actually, I think > reassigning like that could cause a memory leak, can someone confirm?) > If its feasible you may want to replace those lines with > pr

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-26 Thread ben.clinkinbeard
Glad you got it working. Yea, its unfortunate (but unavoidable) that reinitializing a var kills the listeners. (Actually, I think reassigning like that could cause a memory leak, can someone confirm?) If its feasible you may want to replace those lines with prodList.removeAll() and then you should

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-26 Thread dbronk
Thank you very much and this did help. Thought I'd reply what I found to work in case you were interested. First, I guess because my Product class is declared as Bindable, I didn't have to call prodList.itemUpdated(myProduct) which was nice since other objects that update myProduct shouldn't have

[flexcoders] Re: Deep binding with Cairngorm question

2007-10-26 Thread ben.clinkinbeard
Never used the Binding tag so I can't say for certain why adding an item isn't firing your binding. I would think it should but I don't know what kind of listener is being set up by . As far as updating an attribute on a Product, you'll want to call prodList.itemUpdated(myProduct) afterwards but ag