ActionScript 3 Language Specification |
|||
| ActionScript 3.0 Language Specification > 6 Types > 6.1 Type operators > 6.1.2 Operator as | |||
The as operator appears in expressions of the form:
v as T
The purpose of the as operator is to guarantee that a value is of certain type, and, if not, indicate so by returning the value null.
It is common usage to assign the result of an as expression to a property with the same type in that expression. If the destination type does not include null, the assignment will convert null to the default value of that destination type (that is, false for as Boolean and 0 for as Number). This results in loss of information about whether the original value is included in that type. Programs that need to distinguish between when a value is the default value and an incompatible value must assign the result to a property of type Object, check for null, and then downcast to the ultimate destination type.
The steps used to evaluate the as operator are:
null
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification53.html