I suspect that the XML class uses prototype-based inheritence. This is probably required by E4X compliance. - Gordon
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Troy Gilbert Sent: Monday, March 12, 2007 1:43 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Data binding: How to detect data change has happened? Hmm... then how exactly is it that XMLNotifier does it? Or is the XML class use prototype-based inheritence? And I'm definitely aware of AS3's true class-based inheritence... it's really the only way I can keep up with it (the prototype stuff always made my head spin a bit). I was just under the impression that they co-existed (or one piggy-backed on the other), but it make sense that there are VM optimizations for the non-dynamic stuff... Troy. On 12 Mar 2007 13:25:14 -0700, Gordon Smith <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Most Flex components (for example, the 'label' of a Button) are not implemented using prototype-based inheritance. AS3 added true class-based inheritance, and we use that because it has far better performance. The tradeoff for better performance is less dynamic behavior. In particular, with class-based inheritance you can't inject code at runtime. - Gordon ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com <http://yahoogroups.com> ] On Behalf Of Troy Gilbert Sent: Monday, March 12, 2007 1:08 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Data binding: How to detect data change has happened? Actually, wouldn't it be possible to watch any object by injecting code into the prototype to basically put yourself between a property set and the class's property set? From a brief glance at XMLNotifier, it looks like that's exactly what it does... Troy. On 12 Mar 2007 10:45:48 -0700, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: When I mean general, it means that unless some one planned to allow watching via ObjectProxy, then you can't find a way to watch it. ________________________________ From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups.com <http://yahoogroups.com> ] On Behalf Of bruce1976 Sent: Sunday, March 11, 2007 7:49 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Data binding: How to detect data change has happened? I'd agree with everything that you said, except for the last portion: > There is no general property watching in AS, so you have to define > contracts and use events and whatnot. Take a look at the ObjectProxy class, refenced below: http://livedocs.adobe.com/flex/201/langref/mx/utils/ObjectProxy.html <http://livedocs.adobe.com/flex/201/langref/mx/utils/ObjectProxy.html> By wrapping the object that you're interested in into an ObjectProxy, you can get notified by any changes to the new object (just use your new object in place of your old object). Regards, Bruce --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > In the mx.controls.DataGrid, the dataProvider property is not a var, it > is a get/set function pair. When someone assigns dataProvider, the set > function is called so we know it changed. > > > > All dataProviders must implement ICollectionView or will be wrapped in > an ICollectionView. When you change things in an ICollectionView, the > contract is the ICollectionView will spew events which the DataGrid is > listening for. > > > > There is no general property watching in AS, so you have to define > contracts and use events and whatnot. > > > > -Alex > > > > ________________________________ > > From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Greg McCreath > Sent: Sunday, March 11, 2007 3:36 AM > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Data binding: How to detect data change has > happened? > > > > Hi all, > > > > I'm interested to know how in an object with a data binding I can detect > a change in the datasource. > > > > For example, if I were to develop (say) a custom datagrid that (in MXML) > a user of that datagrid can set the datasource property to something > like "{blah.blahblah}". > > > > Then, in that custom datagrid how do I detect that that blah.blahblah > has changed and take some action when it does? In the custom component > I do not want to know of the existence of blah.blahblah, just that it > has changed and what its new value is. > > > > All help appreciated. > > > > Greg. > > ________________________________ > > This email and any files transmitted with it may be confidential and are > intended solely for the use of the individual or entity to whom they are > addressed. This email may contain personal information of individuals, > and be subject to Commonwealth and/or State privacy laws in Australia. > This email is also subject to copyright. If you are not the intended > recipient, you must not read, print, store, copy, forward or use this > email for any reason, in accordance with privacy and copyright laws. If > you have received this email in error, please notify the sender by > return email, and delete this email from your inbox. >