In a FLA or AS file that is in the same directory as Login.as, enter the following ActionScript:
var gus:Login = new Login("Gus", "Smith");
trace(gus.username); // output: Gus
gus.username = "Rupert";
trace(gus.username); // output: Rupert
In the following example, the
function executes when the value is traced. The
function
get
set
triggers only when you pass it a value, as shown in the line:
gus.username = "Rupert";
See also
get,
Object.addProperty()
200
Chapter 5: ActionScript Core Language Elements
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?