I've got a truly bizarre undefined error going here in my ActionScript (code simplified here):
package { public class Main extends Sprite { private function Test() { var testVar:Number = 10; } } }
This returns an error: 1120: Access of undefined property testVar
on line 4.
If I'm reading that correctly, it's complaining that the variable I'm trying to define hasn't yet been defined. Hence my confusion.
This all worked when the function Test was preceded by a giant object declaration, but now that I've moved that to a separate class, I'm getting this error for every single variable declaration in every method of the class.
Update:
It turns out the added class definitions at the end were causing the problem -- but I've no idea why.
Adding
class A {} class B {}
to the end of the .as file caused all the errors to occur, but including just class A {}
or class B {}
makes all the errors go away.
More confusing still, an even better solution was this:
class C {} class A extends C {} class B extends C {}
What is going on here?