public

Flash Player 6.

Usage

class someClassName{
  public var name;
  public 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.

Parameters

name The name of the variable or function that you want to specify as public.

Description

Keyword; specifies that a variable or function is available to any class that calls it. Because variables and functions are public by default, this keyword is used primarily for stylistic reasons. For example, you might want to use it for reasons of consistency in a block of code that also contains private or static variables.

Example

The following two blocks of code are functionally identical.

private var age:Number;
public var name:String;
static var birth:Date;

private var age:Number;
var name:String;
static var birth:Date;

For more information, see Controlling member access.

See also

private, static