Default values in AS3

ActionScript 3
Data type                    default value

int                                         0

uint                                       0

Number                               NaN

Boolean                                false

String                                   null

Object                                   null

All other types/classes     null

untyped or *                        undefined

dictionary[keyObj]                   undefined

The default value for a key in a Dictionary object is undefined, before the key value was assigned or after the key in the dictionary is deleted and even _before_ the key object in the dictionary was created. Flash Player won’t throw out a runtime error, instead, it returns undefined, since Dictionary defines a dynamic collection of properties.

dictionary[an_undefined_or_declared_key_obj]

Adobe says “TBD” for “Constant and variable declarations” in their Flex SDK Coding Conventions and Best Practices. I normally assign a default value when declaring a variable/constant of a primitive data type.

Here and Here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: