views:

100

answers:

1

I am using Flex Builder 3 to develop my first application that will communicate with a server that has many operations, so many in fact it is overwhelming and I am grouping them together into classes that will expose the operations and also manage some client side meta data. I am calling these classes "server proxies" because they are technically similar to a proxy class in WCF. I would want to organize these classes where I can do things like the below where Authentication is a class, and ServerProxies is some feature of the language that allows me to group that class with other classes in the ServerProxies category, or subcatagories such as the Geography subcategory:

ServerProxies.Authentication.AddLoginSuccesfulListener(onLoginSuccessful);
ServerProxies.Authentication.SubmitCredentials(someParaemetersHere);
ServerProxies.Geography.Querying.GetAllTiles(someMoreParameters);
ServerProxies.Geography.Querying.MeasureTwoPoints(pointA,pointB);
ServerProxies.Geography.Display.RenderMapExtent(topLeftPoint,bottomRightPoint);

This example is kind of trivialized because some of these operations probably wouldn't go through a server, but that is not the topic at hand. (just had to say that before someone gets off on a tangent and flames me over some imaginary code)

*So my question is, what language feature of Action Script 3 would allow me to create such categories?

In C# it would have been a namespace, but namespaces in Action Script seem to be more like custom access modifiers that apply to methods and properties, rather than entire classes.

+1  A: 

You have to use packages, in preforms the same task as namespaces in C#.

You can read more about it here: http://www.foundation-flash.com/tutorials/packages/

Lillemanden
Thanks, that works out. The term "package" mislead me to think it had more to do with deployment and packaging (i.e. like a DLL in C#) than API organization.
AaronLS
Yeah, I think they could have picked better names too.
Lillemanden