Namespaces in Actionscript3

by Ruben

For a while now, I've been thinking about how to grant access to certain classes for certain members of another class, while at the same time not making your members accessible to any class (i.e. public).
Then I bumped into this article on LiveDocs about custom namespaces. If you're unfamiliar with the matter it's definitely worth a read.

Namespaces are somewhat similar to the public and private (etc.) attributes in Actionscript syntax (also see my previous post on AS3 class syntax).
It basically works like this; first you define a namespace somewhere, and second you apply it to (for example) a method in some class. Third, and finally, you reference the namespace with the use directive.

Again, have a read, and it'll become much more clear..

UPDATE: Today someone told me that the old link to the LiveDocs page wasn't working anymore, it appears that this is the case for a few other LiveDoc pages as well. I updated the above link with the URL to the page from the Flex LiveDocs, rather than the one from the AS3 LiveDocs..