Hi Maciek,

I don't have any practical experience with attempting to compile service config 
and associated classes into modules and I don't know whether compc would 
support it or not, but based on some informal discussions with Alex and Jeff I 
wouldn't recommend it.

The core issue is that AMF serialization mappings (client to server class 
aliases) within Flash Player aren't scoped per module or even app domain as 
loaded classes are - unfortunately they're scoped to a security domain (broader 
scope). This means that if the root swf loads two or more modules (each will be 
loaded in its own child ApplicationDomain by default), where these modules bake 
in overlapping sets of classes that use [RemoteClass] metadata things won't 
work. The modules will effectively trample each other's registered class 
aliases to point to their respective local classes. Say you have a class Foo 
([RemoteClass(alias="com.Foo")]), that you've compiled into both modules. You 
now have two separate class defs on the client (one per module/sub app domain), 
but only one alias registered (scoped to the security domain both of these app 
domains belong to). When the loosing module receives a Foo off the network it 
will fail to deserialize correctly because the alias mapping points to the 
class def in the other module, which this module doesn't have access to.

I think the best approach for now is to place your service config and all 
shared classes with [RemoteClass] metadata into your root swf, and then expose 
this to your modules through a controlled API - say a registry of network 
services or operations the modules can use. You may be able to get away with 
keeping non-shared classes with [RemoteClass] metadata in specific modules, but 
I haven't tried that.

Best,
Seth

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Maciek 
Sakrejda
Sent: Sunday, December 07, 2008 9:42 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] services-config.xml: compc or just mxmlc?

Does compc care about the contents of the services-config.xml file? If I 
compile a .swc component with compc with one set of services defined, but then 
change the services-config.xml file and build a .swf with mxmlc, are the mxmlc 
service definitions used for everything? Is it some weird combination? I know I 
can probably poke at this through experimentation, but the docs explicitly 
*don't* list service-config as an option that does not apply to compc, so I was 
curious.

-Maciek

Reply via email to