I’m wondering if I’m the only one with this error. Is it a quirk or a feature? Should it be reported to Adobe as a bug?
I found this out (after a while of frustration) that whenever I have a class in the root folder of the global classpath (or even in the same folder as the FLA, just not arranged into a package), even if I use an “import” statement for a “packaged” class with the same name, the compiler will still fetch and use the “global” class definition.
Here is a quick example of how to reproduce it.
Place the following class alongside the FLA:
package
{
public class ClassOne
{
public function ClassOne()
{
trace("Make me an unpackaged class, matey!");
}
public static function tester()
{
trace("Hello, sweet, unpackaged world!");
}
}
}
And put this one in the folder “com/test/”
package com.test
{
public class ClassOne
{
public function ClassOne()
{
trace("I feel so trapped, and so lonely in my class...");
}
public static function tester()
{
trace("Goodbye cruel, packaged world!");
}
}
}
And put this code on the timeline:
import com.test.ClassOne;
var c = new ClassOne(); //Test instance
ClassOne.tester(); //Test static