The 'Flex Remoting/AS3' code generator creates code that follows the model shown below (boxes filled with green represented generated code):
The Service class (Controller) is responsible for client/server communication using the RemoteObject API. The class contains the same methods as the remote service. Invoking a method on the controller object results in a remote method invocation of the class from which the code is generated. When the controller class receives a result from a remote method invocation, it updates the model object with the returned data. The Model object is [Bindable], as a result, the UI components can use data binding with the properties from the Model.
The Usage Example chapter reviews the generated code and demonstrates how to apply in a Flex application.
Data Type Initializer
The code generator creates a special ActionScript class for the Java services which reference complex types in the method signatures. The class is called DataTypeInitializer and contains references to all complex types generated from the Java service. DataTypeInitializer is useful to create full ActionScript compilation closures. It is important to understand that the Flex compiler does not automatically include into the compilation all ActionScript classes added to a project. A class is included into the compiled SWF only if it is explicitly referenced by the code (for some reason simple cast is not considered a reference by the Flex compiler).
Therefore, you should instantiate a DataTypeInitializer in the initialization block of your Flex application. This will guarantee that all referenced classes will be available at runtime.