| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jul 2003
Posts: 2
|
Hello all.
I,m having a little problem with flash remoting. I can't call two differents functions or services. Lets try to explanin better. In Movie_1 I call service 1. When testing it standalone it works. In Movie_2 I call service 2. When testing it standalone it works. Movie 3 calls Movie 1 and the service 1 runs Ok but when Movie 3 calls Movie 2 then services 2 do not run. Movie 3 calls back Movie 1 and service 1 runs. And the other way around doesn't work either. Example: Movie 3 calls Movie 2 and the service 2 runs Ok but when Movie 3 calls Movie 1 then services 1 do not run. Movie 3 calls back Movie 2 and service 2 runs. Here is the code. In order to reuse some code I create this include file: // ************* The connection Stuff ********************** //The file name is connectionScript.as #include "NetServices.as" //Setting the service connection Object // Only create the connection Obj if the connection Object do no exist if (_global._gatewayConnectionOpen == undefined || _global._gatewayConnection == false) { initConnection(); } //Create the connection object function initConnection() { NetServices.setDefaultGatewayURL("http://localhost/myUrl/gateway.aspx"); //Make the serviceConnection Object global so it could be reused later _global.serviceConnection = NetServices.createGatewayConnection(); // A flag to check if the connection has been open _global._gatewayConnectionOpen = true; } /* *********************************************** *************** Getting remote Objects ******* ************************************************* */ //General function to create objects function getRemoteObject(remoteObj, serviceName) { if (remoteObj == undefined || remoteObj == null ) { remoteObj = _global.serviceConnection.getService(serviceName); } return globalObj } function setRemoteObject1() { //Make this object globlal so it could be reused later in other movies. _global._remoteObject1 = getRemoteObject(_global._remoteObject1 , "Service1") } function setRemoteObject2() { //Make this object globlal so it could be reused later in other movies. _global._remoteObject2 = getRemoteObject(_global._remoteObject2 , "Service2") } I have also create another include file to handling service results The file name is resultHandle.as //Defining the return Object // General result handler object function obj_resultHandler () { this.onResult = function (result) { doSomething(result); } this.onStatus = function (status) { trace (status.description) } } So in my Movie 1 I have something like: //including the resultHandle #include resultHandle.as //including the connection script #include connectionScript.as //Creating the remote Object 1 that will call service 1 setRemoteObject1(); //Calling the function that service1 provide and passing the obj_resultHandler as the response object _global._remoteObject1.function1(new obj_resultHandler()); //All this works if call stand alone. For movie 2 is the same thing: /including the resultHandle #include resultHandle.as //including the connection script #include connectionScript.as //Creating the remote Object 1 that will call service 2 setRemoteObject2(); //Calling the function that service1 provide and passing the obj_resultHandler as the response object _global._remoteObject2.function2(new obj_resultHandler()); //All this works if call stand alone. Any idea what is wrong? I know this is a little bit large but any help will be appreciated. Thanks in advance. |
|
|
|
|
|
#2 |
|
Deprecated User?
|
I'm assuming that the moderator will eventually move this, but in the meantime, I thought I'd let you get a head start.
There is a Flash Remoting Forum . You might want to check there. Best of luck.
__________________
Check out my comic strip: With a Twist |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jan 2003
Location: berlin
Posts: 130
|
do u have an empty line at begining and at the end of u're both as files?
|
|
|
|
|
|
#4 |
|
Registered User
Join Date: Jul 2003
Posts: 2
|
I'm not sure what you mean with the empty lines. How that affect the actionscript files?
Best regards |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Jan 2003
Location: berlin
Posts: 130
|
well it turns out that wenn u include more then one as all as's have to have an empty line at the end of as-file.
i dont know does this will solve u're , but i had the same problem and after fixing that it worked |
|
|
|
|
|
#6 |
|
Registered User
|
I am having the same problem. I have a parent swf that calls two child swf files. Both child swf files call their own cfc. When I play the child swf's individually, they work fine, but when I call them from the parent swf, only the first child called returns data.
If you could help me out, i'd appreciate it. Dechirico0 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|