set
Availability
Flash Player 6.
Usage
function set property(varName) {
// your statements here
}
Parameters
Word that refers to the property that
property
the value used in the corresponding
The local variable that sets the value you're assigning.
varName
Returns
Nothing.
Description
Keyword; permits implicit setting of properties associated with objects based on classes you have
defined in external class files. Using implicit set methods lets you modify the value of an object's
property without accessing the property directly. Implicit get/set methods are syntactic shorthand
for the
Object.addProperty()
getter/setter methods" on page
Example
The following example creates a Login class that demonstrates how the
to set private variables:
class Login {
private var loginUserName:String;
private var loginPassword:String;
public function Login(param_username:String, param_password:String) {
this.loginUserName = param_username;
this.loginPassword = param_password;
}
public function get username():String {
return this.loginUserName;
}
public function set username(param_username:String):Void {
this.loginUserName = param_username;
}
public function set password(param_password:String):Void {
this.loginPassword = param_password;
}
}
ActionScript Core Language Elements
set
command.
get
method in ActionScript 1. For more information, see
63.
will access; this value must be the same as
keyword can be used
set
CHAPTER 5
"Implicit
set
199
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?