Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shared objects

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
im trying to make this shared object thing work but its not working out the way i hoped.


this is the situation

im trying to make a chess game and each piece needs to be a shared object. i would like to keep the scripting all together in 1 root function so iv made each piece an MC with a button in it with this script:

Code:
on (press) {
	_parent.moveobj("white_pawn_8", "white");
}
on (release, releaseOutside) {
	_parent.releaseobj("white_pawn_8", "white");
}

so far so good, this works; the functions are called.

in the root i have these functions:
Code:
// Manipulate the piece
function moveobj(objname,col)
	{
		_level0[objname+"_MC"].onMouseMove = function()
			{
				if(_level0[objname+"_so"]){
				
				_level0[objname+"_so"].data.x = _level0[objname+"_MC"]._x = _xmouse;
				
				_level0.white_pawn_8_so.data.y = _level0[objname+"_MC"]._y = _ymouse;
				
				}else{
					
					_level0[objname+"_so"] = SharedObject.getRemote(_level0[objname+"_pos"], _parent.client_nc.uri, false);
					
					_level0[objname+"_so"].onSync = function(list) {
						_level0[objname+"_MC"]._x = _level0[objname+"_so"].data.x;
						_level0[objname+"_MC"]._y = _level0[objname+"_so"].data.y;
					};
					
					_level0[objname+"_so"].connect(_parent.client_nc);
				}
				
			};
	}


// Release control of the piece
function releaseobj(objname,col)
	{
			delete _level0[objname+"_MC"].onMouseMove;	
	}

now this half works, the pieces i click+drag are moved and released just they way they should be but the vars are not being passed to the server, if i open 2 windows i can move the piece all i want but it wont budge in the other window....

help! :eek:)

Thank you
Thomas

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
nobody?

I learned a bit yesterday, today i learned a lot, imagine what i'll learn tomorrow!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top