Thanks,
Greg Andora
-----Original Message-----
From: Gordon Smith [mailto:[EMAIL PROTECTED]
Sent: Monday, March 28, 2005 8:02 PM
To: 'flexcoders@yahoogroups.com'
Subject: RE: [flexcoders] Change Events for Custom ClassesIf all you want to do is get myProperty_Changed() to execute when the app does MyClass.myProperty=5, you don't necessarily need any events."Getter" and "setter" functions let you execute code when you read or write a property:// storage for myProperty propertyprivate var _myProperty;// The getter function executes when somebody does value = myClass.myProperty;public function get myProperty{return _myProperty};// The setter function executes when somebody does myClass.myProperty = valuepublic function set myProperty(value){_myProperty = value;// Perform some side effectsmyProperty_Changed();}If you really need to dispatch an event, you would call dispatchEvent() in the setter.- Gordon-----Original Message-----
From: Andora, Greg [mailto:[EMAIL PROTECTED]
Sent: Monday, March 28, 2005 11:55 AM
To: 'flexcoders@yahoogroups.com'
Subject: [flexcoders] Change Events for Custom ClassesI'm wondering if there is a way (and if there is, how would I go about doing it) I can create a change event for a custom MXML class based for a public property.
For example, I have an MXML file called MyClass and when the parent application changes "myProperty" (i.e MyClass.myProperty=5), I want my custom class to respond by calling the private function myProperty_Changed():
<mx:Canvas xmlns:mx="http://www.macromedia.com/2003/mxml"
width="{lookupWidth}"
focusOut="" >
<mx:Script>
<![CDATA[
public var myProperty;private function myProperty_Changed()
{
Do Stuff Here when myProperty is changed by the application it is being used in;}
]]>
</mx:Script>
<mx:TextInput id="text1" />
</mx:Canvas>
Thanks,
Greg Andora
----
This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]
Littler Mendelson, P.C.
http://www.littler.com
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
----
This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
To reply to our email administrator directly, send an email to
[EMAIL PROTECTED]
Littler Mendelson, P.C.
http://www.littler.com