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 variable’s type; when used in a function declaration or definition, this
operator specifies the function’s 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 = "";
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...