Statements
207
return Math.PI*this.radius*this.radius;
};
this.getDiameter = function() {
return 2*this.radius;
};
this.setRadius = function(param_radius) {
this.radius = param_radius;
}
}
// ActionScript 2.0 code that uses the Circle class
var myCircle:Circle = new Circle(5);
trace(myCircle.getArea());
trace(myCircle.getDiameter());
myCircle.setRadius("10");
trace(myCircle.radius);
trace(myCircle.getArea());
trace(myCircle.getDiameter());
See also
class statement
private statement
class
someClassName
{
private var
name
;
private function
name
() {
// your statements here
}
}
Note:
To use this keyword, you must specify ActionScript 2.0 and Flash Player 6 or later in
the Flash tab of your FLA file's Publish Settings dialog box. This keyword is supported only
when used in external script files, not in scripts written in the Actions panel.
Specifies that a variable or function is available only to the class that declares or defines it or to
subclasses of that class. By default, a variable or function is available to any caller. Use this
keyword if you want to restrict access to a variable or function.
You can use this keyword only in class definitions, not in interface definitions.
Availability:
ActionScript 2.0; Flash Lite 2.0
Parameters
name
:
String
- The name of the variable or function that you want to specify as private.
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...