These are a way to implement a property when you want getting or setting
the property to have side effects.
 
The "setter" is called when you set the property. For example,
 
    statesNames = foo;
 
will call function set statesNames with value equal to foo.
 
The "getter" is called when you get the property. For example, when you
write
 
    foo = statesNames;
 
or
 
    doSomething(statesNames)
 
the value of statesNames will be the value returned by function get
statesNames.
 
All Flex APIs favor using properties rather than methods, so in general
you should write this type of getter/setter property. Use of APIs like
getBlah() and setBlah() is discouraged unless they require arguments or
take a long time to execute.
 
- Gordon

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of tjcox1969
Sent: Tuesday, April 24, 2007 1:38 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Help on the syntax for function set
blah(param:String)



I have read the section on functions in the Adobe Programming
Actionscript manual, but I see no reference to this type of syntax:

[Bindable]
public function set statesNames(value:ListCollectionView):void {
_statesNames = value;
}

public function get statesNames():ListCollectionView {
return _statesNames;
}

Can someone point me to some documentation on this or give a brief
explanation. I am looking at a sample I found and it works, but I
want to know why and when to use this type of "function set blah()"
syntax over "function setBlah()"

Thanks!



 

Reply via email to