Log inSkip to content

Archive for April 13, 2008

Namespace and URI

Sunday, April 13, 2008 at 17:35:31

Recently I played a little bit with namespaces in ActionScript 3 and found a somewhat weird thing. Namespaces have an associated URI which makes them unique. When you define a namespace you can specify an explicit URI or you can omit it. In the latter case the compiler will assign a unique value automatically, so everything should work perfectly. Class members placed into a namespace can be referenced by two ways:

1) by opening the namespace and then referring to the desired member:

1
2
use namespace something;
myFunction();

2) by qualifying the method or property with the namespace:

1
something::myFunction();

This is what the documentation says. But in practice when I omit the URI only the first way will work and the second one will not. The compiler passes over, everything seems to be OK, but suddenly my namespaces defined without URI are not found at run-time. E.g. I have a package where I define two namespaces, one without an explicit URI and one with a URI:
(more…)

Categories

Monthly Archives