User Guide

98 Chapter 5: ActionScript Core Language Elements
this.container_mc.createTextField("date_txt", this.getNextHighestDepth(), 0,
0, 100, 22);
this.container_mc.date_txt.autoSize = true;
this.container_mc.date_txt.text = new Date();
The dot (.) operator is used when targeting instances within the SWF file and when you need to
set properties and values for those instances.
: (type)
Availability
Flash Player 6.
Usage
[modifiers] var variableName:type
function functionName():type { ... }
function functionName(parameter1:type, ... , parameterN:type) [ :type ]{ ... }
Parameters
variableName
An identifier for a variable.
type A native data type, class name that you have defined, or interface name.
functionName An identifier for a function.
parameter An identifier for a function parameter.
Description
Operator; used for strict data typing; this operator specifies the variable type, function return
type, or function parameter type. When used in a variable declaration or assignment, this
operator specifies the variables type; when used in a function declaration or definition, this
operator specifies the functions return type; when used with a function parameter in a function
definition, this operator specifies the variable type expected for that parameter.
Types are a compile-time-only feature. All types are checked at compile time, and errors are
generated when there is a mismatch. Mismatches can occur during assignment operations,
function calls, and class member dereferencing using the dot (
.) operator. To avoid type
mismatch errors, use strict data typing (see “Strict data typing” on page 24).
Types that you can use include all native object types, classes and interfaces that you define, and
Function and Void. The recognized native types are Boolean, Number, and String. All built-in
classes are also supported as native types. For more information, see About data types”
on page 18.
For more information, see “Operator precedence and associativity” on page 32.
Example
Usage 1: The following example declares a public variable named userName whose type is String
and assigns an empty string to it:
var userName:String = "";