Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > Flash Remoting

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-29-2003, 05:45 PM   #1
ioa
Registered User
 
Join Date: Jul 2003
Posts: 2
Unhappy Flash remoting problem

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.
ioa is offline   Reply With Quote
Old 07-29-2003, 05:54 PM   #2
dzy2566
Deprecated User?
 
dzy2566's Avatar
 
Join Date: Jul 2003
Location: Sherman Oaks, Ca
Posts: 1,086
Send a message via AIM to dzy2566
Default

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.
dzy2566 is offline   Reply With Quote
Old 07-29-2003, 09:04 PM   #3
mediaholic
Registered User
 
Join Date: Jan 2003
Location: berlin
Posts: 130
Default

do u have an empty line at begining and at the end of u're both as files?
mediaholic is offline   Reply With Quote
Old 07-30-2003, 11:38 AM   #4
ioa
Registered User
 
Join Date: Jul 2003
Posts: 2
Default About the empty lines

I'm not sure what you mean with the empty lines. How that affect the actionscript files?

Best regards
ioa is offline   Reply With Quote
Old 07-30-2003, 11:54 AM   #5
mediaholic
Registered User
 
Join Date: Jan 2003
Location: berlin
Posts: 130
Default

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
mediaholic is offline   Reply With Quote
Old 06-06-2004, 12:43 PM   #6
Dechirico0
Registered User
 
Join Date: Jun 2004
Posts: 2
Send a message via AIM to Dechirico0
Default Having the same trouble here, but can't find a solution

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
Dechirico0 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.