Hi everyone,
My code below is used to move cubes on stage using mouse but sofar it simply isnt working. the code seems correct and ive spent days just trying to figure it out, but no luck:( So wondering, whether an outside view could spot the problem? any help appreciated.
Thnx.
//connect, create a shared object, and connect it
stop();
user_nc = new NetConnection();
user_nc.onStatus = function(info) {
trace("Level: " + info.level + " Code: " + info.code);
};
user_nc.connect("rtmp://localhost/cubes");
cube_so = SharedObject.getRemote("breaching", user_nc.uri, false);
cube_so.connect(user_nc);
//let all the cubes be equal
for (i; i <= 26; i++) {
clickedCube = eval("_root.cube" + i);
//Add a name property to each cube
clickedCube.name = "cube" + i;
clickedCube.onPress = function() {
//move the cube
this.onMouseMove = function() {
cube_so.data[this.name].x = this._x = _root._xmouse;
cube_so.data[this.name].y = this._y = _root._ymouse;
};
};
//on release let go of the cube
clickedCube.onRelease = clickedCube.onReleaseOutside = function () {
if (this.hitTest(_root.receptor)) {
this.gotoAndStop(this._currentframe + 1);
}
delete this.onMouseMove;
};
}
//update users cubes
cube_so.onSync = function(list) {
clickedCube._x = cube_so.data[list[0].name].x;
clickedCube._y = cube_so.data[list[0].name].y;
};