RE: [flexcoders] Implicit change events for [Bindable] properties? and some notes on ModelLocator
Yeah, I think this is something that could eventually go into the tool. Matt -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aldo Bucchi Sent: Tuesday, February 21, 2006 11:06 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Implicit change events for [Bindable] properties? and some notes on ModelLocator Hi Matt, yeah... more clarity, but at the expense of quite some boiler-plate code. I really believe you should consider adding support for this requirement at the generator level, something like [BindableWithAutoEvent("myPropChanged")] public var myProp:String; this way I would still be expressing the intent, but avoiding the overhead. otherwise, integrate it into zorn... ( a la java's "Source > Generate Getters and Setters..." ). for now, I use a handy app that generates the code for me: http://www.macromedia.com/2005/mxml"; xmlns="*" layout="vertical"> Best, Aldo On 2/22/06, Matt Chotin <[EMAIL PROTECTED]> wrote: > Yes binding will generate the "objectChange" when it's done > automatically, but you'd need to look at the details to figure out if > it's the right property for you. Generally if you find yourself wanting > to handle the event it's a good idea to do the re-write yourself because > I think it's clearer what you intend to accomplish rather than relying > on code-gen. > > Matt > > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Aldo Bucchi > Sent: Monday, February 20, 2006 12:36 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Implicit change events for [Bindable] properties? > and some notes on ModelLocator > > Hi all, > > I USUALLY FIND MYSELF REWRITING THE FOLLOWING STATEMENT > > > > [Bindable] > public var selectedItem:ItemVO; > > > > TO SOMETHING LIKE THIS > > > > private var __selectedItem:ItemVO; > [Bindable("selectedItemChanged")] > public function get selectedItem():ItemVO{ > return __selectedItem; > } > public function set selectedItem( v:ItemVO ):void{ > __selectedItem = v; > dispatchEvent( new Event("selectedItemChanged") ); > } > // I ommited the Event metadata of course > > > SO I CAN DO THIS... > > > > selectedItemChanged="doSomethingThatCannotBeDoneThroughBinding()"/> > > > > is there an implicit event that is fired when a Bindable property is > changed?? > I have digged a little into the generated AS and apparently the > "objectChange" event is used in general... but Is there a more > granular approach? > > As a tangent to this issue.. ( now this is just in case any cairngorm > fella is reading this ), I believe that the ModelLocator should be > wrapp'able as an MXML tag to support inline event handlers... I always > do that with my model locators ( I just call them models though ). > > Of course the MXML wrapper would create a new instance, which itself > would be wrapping a singleton. there are some patterns around that ( > all of which involve some unwanted boiler plate code and repetition ). > I will post some more on this later perhaps. need some sleep now. good > night ;) > > Best, > Aldo > > > > > > > > -- > : Aldo Bucchi : > mobile (56) 8 429 8300 > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- : Aldo Bucchi : mobile (56) 8 429 8300 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Implicit change events for [Bindable] properties? and some notes on ModelLocator
Hi Matt, yeah... more clarity, but at the expense of quite some boiler-plate code. I really believe you should consider adding support for this requirement at the generator level, something like [BindableWithAutoEvent("myPropChanged")] public var myProp:String; this way I would still be expressing the intent, but avoiding the overhead. otherwise, integrate it into zorn... ( a la java's "Source > Generate Getters and Setters..." ). for now, I use a handy app that generates the code for me: http://www.macromedia.com/2005/mxml"; xmlns="*" layout="vertical"> Best, Aldo On 2/22/06, Matt Chotin <[EMAIL PROTECTED]> wrote: > Yes binding will generate the "objectChange" when it's done > automatically, but you'd need to look at the details to figure out if > it's the right property for you. Generally if you find yourself wanting > to handle the event it's a good idea to do the re-write yourself because > I think it's clearer what you intend to accomplish rather than relying > on code-gen. > > Matt > > -Original Message- > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Aldo Bucchi > Sent: Monday, February 20, 2006 12:36 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Implicit change events for [Bindable] properties? > and some notes on ModelLocator > > Hi all, > > I USUALLY FIND MYSELF REWRITING THE FOLLOWING STATEMENT > > > > [Bindable] > public var selectedItem:ItemVO; > > > > TO SOMETHING LIKE THIS > > > > private var __selectedItem:ItemVO; > [Bindable("selectedItemChanged")] > public function get selectedItem():ItemVO{ > return __selectedItem; > } > public function set selectedItem( v:ItemVO ):void{ > __selectedItem = v; > dispatchEvent( new Event("selectedItemChanged") ); > } > // I ommited the Event metadata of course > > > SO I CAN DO THIS... > > > > selectedItemChanged="doSomethingThatCannotBeDoneThroughBinding()"/> > > > > is there an implicit event that is fired when a Bindable property is > changed?? > I have digged a little into the generated AS and apparently the > "objectChange" event is used in general... but Is there a more > granular approach? > > As a tangent to this issue.. ( now this is just in case any cairngorm > fella is reading this ), I believe that the ModelLocator should be > wrapp'able as an MXML tag to support inline event handlers... I always > do that with my model locators ( I just call them models though ). > > Of course the MXML wrapper would create a new instance, which itself > would be wrapping a singleton. there are some patterns around that ( > all of which involve some unwanted boiler plate code and repetition ). > I will post some more on this later perhaps. need some sleep now. good > night ;) > > Best, > Aldo > > > > > > > > -- > : Aldo Bucchi : > mobile (56) 8 429 8300 > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- : Aldo Bucchi : mobile (56) 8 429 8300 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Implicit change events for [Bindable] properties? and some notes on ModelLocator
Yes binding will generate the "objectChange" when it's done automatically, but you'd need to look at the details to figure out if it's the right property for you. Generally if you find yourself wanting to handle the event it's a good idea to do the re-write yourself because I think it's clearer what you intend to accomplish rather than relying on code-gen. Matt -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aldo Bucchi Sent: Monday, February 20, 2006 12:36 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Implicit change events for [Bindable] properties? and some notes on ModelLocator Hi all, I USUALLY FIND MYSELF REWRITING THE FOLLOWING STATEMENT [Bindable] public var selectedItem:ItemVO; TO SOMETHING LIKE THIS private var __selectedItem:ItemVO; [Bindable("selectedItemChanged")] public function get selectedItem():ItemVO{ return __selectedItem; } public function set selectedItem( v:ItemVO ):void{ __selectedItem = v; dispatchEvent( new Event("selectedItemChanged") ); } // I ommited the Event metadata of course SO I CAN DO THIS... is there an implicit event that is fired when a Bindable property is changed?? I have digged a little into the generated AS and apparently the "objectChange" event is used in general... but Is there a more granular approach? As a tangent to this issue.. ( now this is just in case any cairngorm fella is reading this ), I believe that the ModelLocator should be wrapp'able as an MXML tag to support inline event handlers... I always do that with my model locators ( I just call them models though ). Of course the MXML wrapper would create a new instance, which itself would be wrapping a singleton. there are some patterns around that ( all of which involve some unwanted boiler plate code and repetition ). I will post some more on this later perhaps. need some sleep now. good night ;) Best, Aldo -- : Aldo Bucchi : mobile (56) 8 429 8300 -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/