Joseph Balderson wrote:
Why it is illegal to combine both a path declaration and a datatype declaration in the same expression" i.e.:
[snip]
// illegal syntax error
this.clip1.myVar:Number = 42;

When you specify a type, you are declaring an object to the compiler. Based on that, the compiler will check the code for any expressions that conflict with the known declaration. It can only do this at compile-time: there is no runtime type-checking.

When you use a path reference, you are doing one of three things:

1. Dereferencing a typed variable, which must be declared somewhere else.
2. Dereferencing an existing dynamic variable.
3. Creating a dynamic variable at runtime.

The reasons why none of these can legally have a type specifier:

1. You can't declare something twice - the compiler already knows the type.
2. By definition, you can't know what type it is, so trying to specify one here is a form of unsafe casting.
3. In this case any declaration to the compiler is meaningless.

- Robert
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to