Hi Your best bet is probably to use import.mx.remoting etc.. into a base movie
that loads subsequent SWFs. Create your service etc there and put it into
global scope. Then ALL you need to do is make your calls to the global scope
with custom responders. The code below should do the trick but in no means is
the only way of doing it import mx.remoting.DataGlue; import
mx.remoting.NetServices;
NetServices.setDefaultGatewayUrl('http://localhost/flashservices/gateway');
gatewayConnection = NetServices.createGatewayConnection(); _global.myService =
gatewayConnection; _global.serviceConnection =
_global.myService.getService('myservices.service.cfc');
_global.serviceConnection.yourmethod(new CustomReponder(),yourargs);
function CustomResponder() { this.onResult = function(result) { // stuff to
do } } this.onStatus = function(error) { trace(error.code+' -
'+error.description); } }
First of all, thanks for your reply!
That was what i was trying to do: only the main movie imports remoting,
instances the services to the global stack and then it loads subsequent movies.
But, when the subsequent movies call the service, they have to attach
responders to the call. Like:
_global.serConfig.getInfoEtiqueta().responder = new RelayResponder(this,
"echoString_Result", "onStatus");
The problem, is where i define this responders. It would be great help, if
they were defined in my loaded movies. The problem is that actionscript 2.0
strict typing doesn't allow this, i have to import the remoting services. I mean
Responder Definition Header:
function echoString_Result(result:ResultEvent)
Error retrieved
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 5: The class
'ResultEvent' could not be loaded. function
echoString_Result(result:ResultEvent)
Now... I am thinking in two possible solutions (not perfect, but, hey...). The
first one, is to create a general custom responder that is defined in the root
movie, and it receives also a callback function (defined in the loaded movie).
When the responder is called, it passes the value on result.result to the
callback. The second one, is to import the ResultEvent class in every movie
that needs it. Problems: added filesize, and... doesn't know if it really works.
Well... i'll try both this solutions, but if there is a better one, please,
let me know!!
(The ideal one was to put the remotingClasses in a shared library, and use
them importing from the library.. but, i wasn't able to get it to work).
Thanks for your attention, once again!