Re: [flexcoders] Event Handlers inside custom components
I actually figured this out right after I asked but I did it a different way. It does basically the same thing though. Here is an example: - - - - >From: Manish Jethani <[EMAIL PROTECTED]>>Reply-To: flexcoders@yahoogroups.com>To: flexcoders@yahoogroups.com>Subject: Re: [flexcoders] Event Handlers inside custom components>Date: Thu, 28 Jul 2005 23:12:51 +0530>>On 7/28/05, Archibald Scatflinger <[EMAIL PROTECTED]> wrote:>> > I do not want to use implicit getter/setters because I want the> > components property to be bindable.>>To make the component's property bindable, specify a "ChangeEvent" for>the property and dispatch the event when the value changes.>>e.g.>>>> > >> // Storage for 'labelText' property> private var _labelText:String = "";>> [ChangeEvent("labelTextChange")]> public function get labelText():String> {> return _labelText;> }> public function set labelText(value:String):Void> {> if (value != _labelText)> {> _labelText = value;> dispatchEvent({type: "labelTextChange"});> }> }> >>>When labelText is modified, the component dispatches an event to>trigger binding. Check out the generated AS to see how this works.>>Manish -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Computer software testing Macromedia flex Development Software developer YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Event Handlers inside custom components
I actually figured this out right after I asked but I did it a different way. It does basically the same thing though. Here is an example: - - - - >From: Manish Jethani <[EMAIL PROTECTED]>>Reply-To: flexcoders@yahoogroups.com>To: flexcoders@yahoogroups.com>Subject: Re: [flexcoders] Event Handlers inside custom components>Date: Thu, 28 Jul 2005 23:12:51 +0530>>On 7/28/05, Archibald Scatflinger <[EMAIL PROTECTED]> wrote:>> > I do not want to use implicit getter/setters because I want the> > components property to be bindable.>>To make the component's property bindable, specify a "ChangeEvent" for>the property and dispatch the event when the value changes.>>e.g.>>>> > >> // Storage for 'labelText' property> private var _labelText:String = "";>> [ChangeEvent("labelTextChange")]> public function get labelText():String> {> return _labelText;> }> public function set labelText(value:String):Void> {> if (value != _labelText)> {> _labelText = value;> dispatchEvent({type: "labelTextChange"});> }> }> >>>When labelText is modified, the component dispatches an event to>trigger binding. Check out the generated AS to see how this works.>>Manish -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Event Handlers inside custom components
On 7/28/05, Archibald Scatflinger <[EMAIL PROTECTED]> wrote: > I do not want to use implicit getter/setters because I want the > components property to be bindable. To make the component's property bindable, specify a "ChangeEvent" for the property and dispatch the event when the value changes. e.g. http://www.macromedia.com/2003/mxml"; xmlns="*"> // Storage for 'labelText' property private var _labelText:String = ""; [ChangeEvent("labelTextChange")] public function get labelText():String { return _labelText; } public function set labelText(value:String):Void { if (value != _labelText) { _labelText = value; dispatchEvent({type: "labelTextChange"}); } } When labelText is modified, the component dispatches an event to trigger binding. Check out the generated AS to see how this works. Manish -- 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] Event Handlers inside custom components
Yes, using object.watch(prop, callback [, user data]) On 7/28/05, Archibald Scatflinger <[EMAIL PROTECTED]> wrote: > I have a custom component and I want to make it so that when one of > its properties is changed by an external source then it triggers one > of the components methods. > > I realize that this is probably really simple and I am just missing > something but everything I have tried has either produced errors or > just not worked. > > I do not want to use implicit getter/setters because I want the > components property to be bindable. > > > For example: > > When this happens: > > MyCustomComponent.someproperty = "SomeNewValue"; > > I want it to trigger this: > > MyCustomComponent.DoSomeFunction(); > > I want this to be defined inside of the component though so it is > invisible outside of the component. > > > > Any thoughts? > > > Is this as easy as I think it should be? > > > > > > > > > -- > 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 > > > > > > > -- Regards, Scott Barnes http://www.mossyblog.com -- 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/