Get Statement - MACROMEDIA FLASHLITE2 ACTIONSCRIPT-LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

The following function creates a LoadVars object and loads params.txt into the SWF file.
When the file successfully loads,
var myLV:LoadVars = new LoadVars();
myLV.load("params.txt");
myLV.onLoad = function(success:Boolean) {
trace("variables loaded");
}

get statement

function get property () { // 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.
Permits implicit getting of properties associated with objects based on classes you have defined
in external class files. Using implicit get methods lets you access properties of objects without
accessing the property directly. Implicit get/set methods are syntactic shorthand for the
Object.addProperty()
Availability: ActionScript 2.0; Flash Lite 2.0
Parameters
- The word you use to refer to the property that
property:String
must be the same as the value used in the corresponding
Example
In the following example, you define a Team class. The Team class includes get/set methods
that let you retrieve and set properties within the class:
class Team {
var teamName:String;
var teamCode:String;
var teamPlayers:Array = new Array();
function Team(param_name:String, param_code:String) {
this.teamName = param_name;
this.teamCode = param_code;
}
function get name():String {
return this.teamName;
}
function set name(param_name:String):Void {
this.teamName = param_name;
}
}
200
ActionScript language elements
variables loaded
method in ActionScript 1.
traces:
accesses; this value
get
command.
set

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash lite 2

Table of Contents