Groups | Blog | Home
all groups > macromedia flash flash remoting > august 2004 >

macromedia flash flash remoting : accessing remoting connection outside of main tl.


ginx75
8/26/2004 7:37:30 PM
I have added my connection on the main timeline. I can also run the
'serviceObject.insertStat("7028799","1","00:00") ;' line which works from the
main timeline.

I need to be able to run the 'serviceObject.insertStat("7028799","1","00:00")
;' from with a screen or movie clip that has been loaded into another level.

How do i reference the object properly?
_root._level0.serviceObject.insertStat("7028799","1","00:00") ;?

Do i need to include anything such as the top 3 lines?
Code:

#include "NetServices.as"
#include "NetDebug.as"
#include "DataGlue.as"

// Connect to the gateway and create a service object ** only run this code
once **
if (connected == null) {
connected = true;

NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway/");
gatewayConnection = NetServices.createGatewayConnection();
serviceObject = gatewayConnection.getService("pureonline_.remoting.remoting",
this);
//trace ("connection made");

}

serviceObject.insertStat("7028799","1","00:00");
function insertStat_Result (result) {
var statUpdateID = result;
}



In my first screen on it's main timeline I have the code

The code doesn't seem to run. This is where I feel i am missing something.
I need to use the service i already established. hoping to not have to
re-write the connection details in all my loaded movieclips.

Code:
serviceObject.insertStat("7028799","1","00:00");
function insertStat_Result (result) {
trace("time added NEW:"+result);
_root._level0.curMember.text = result;
}




Thanks for any help.
Trajik
8/31/2004 3:21:22 AM
If you have successfully created a Remoting connection in your main timeline
you can make calls to it from other levels in several ways. First, you can
reference anything in level 0 using _level0.functionName or
_level0.variableName, etc. You can also create your Remoting connection in the
_global scope and reference it from anywhere in your movies or levels. This is
not a recommended practice though.
jameslyon
9/8/2004 3:43:36 PM
AddThis Social Bookmark Button