views:

56

answers:

1

Hi,

I am working on a library that I wish to hide the internals of to the outside world.

I figured I can use 'internal class' where ever I wanted to hide the class,

How ever to my understanding, declaring a class in namespace test.NS1 means it can only access classes defines in test.NS1 and nothing else.

For example,

(both in the same library)

/src/NS/test.as - internal class
/src/NS/test2/test2.as - internal class

test / test2 cannot see each other. Am I missing something here? or is there no proper way to hide my internal classes yet let them talk within the library ?

+2  A: 

The namespace "internal" restricts access to classes defined within the same package. Therefore, a class com.mycompany.app.Foo can see the internal class com.mycompany.app.Bar, but not com.mycompany.app.data.Baz.

See http://www.adobe.com/livedocs/flex/201/langref/statements.html#internal

Colin Cochrane
Thanks for the response, Essentially it means I can not 'hide my classes' from outside while also building my package directories in a logical manner?
Alon
Not with the "internal" namespace, if you want it to apply to sub-packages. An alternative would be to define your own custom namespace and use it for classes you want to be "hidden", similar to the as3_internal namespace. Developers can still get at it if they really want to, but it won't be visible by default.
Colin Cochrane