Log inSkip to content

Archive for April 2008

ApplicationDomain – parent and child

Tuesday, April 15, 2008 at 22:29:34

When loading a SWF into a Flash movie you can specify the application domain which the loaded movie will use. If this application domain is a child domain of the loader’s (or other movie’s) domain and “the child defines a class with the same name as a class already defined by the parent, no error results; the child simply inherits the parent’s definition of that class, and the child’s conflicting definition goes unused unless either child or parent calls the ApplicationDomain.getDefinition() method to retrieve it.” (quoted from the documentation)

The first part of the quoted sentence is true, but the second one is not working. Calling getDefinition() on the child domain will return a reference to the parent’s class instead of the child’s original one. I think this is rather a mistake in the documentation than a player bug, since it seems quite logical: referencing a class by the normal way and through getDefinition() should evaluate to the same value. Anyway, I already posted a small note about that to the online documentation.

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