sendObject / onObjectReceived in flash cs3
Posted: 07 Jun 2007, 17:29
I'm not getting any response with the sendObject method, though it may be the onObjectReceived method that isn't being triggered. I've read through the forums for people having similar problems and I can verify that I've already joined a room, and that the login, joining, roomlist, and connection have all happened in another frame, not the current frame.
for debugging I've also sent a public message along with my object, and this works handsomely. I've also checked the server administrator for data-in, I know that hitting refresh on the server-admin will increase your data-input, but it looks like the object is definitely coming in as well.
I'm not using the .swc, because I couldn't get that to install correctly. Instead I'm using the free download for smartfoxserver pro and the as3 api that lapo posted at http://forums.smartfoxserver.com/viewtopic.php?t=1424
Any help or insight would be GREATLY appreciated. Thank you.
/*the classes have been imported on frame1, and all the connections have been made on that frame as well. */
smartfox.addEventListener(SFSEvent.onAdminMessage, onAdminMessage);
smartfox.addEventListener(SFSEvent.onObjectReceived, onObj);
smartfox.addEventListener(SFSEvent.onPublicMessage, onPublicMessage);
box_mc.addEventListener(MouseEvent.MOUSE_DOWN, onMDown);
box_mc.addEventListener(MouseEvent.MOUSE_UP, onMUp);
box_mc.addEventListener(Event.ENTER_FRAME, onEnter);
function onAdminMessage (e:SFSEvent) {
admin_txt.text = e.params.message;
};
function onObj (e:SFSEvent):void {
trace ('something here!');
trace (e.params);
//server_txt.text = e.params.obj.px;
//server_txt.text = (e.params.message);
};
function onPublicMessage (e:SFSEvent) {
server_txt.appendText(e.params.message)
};
function onEnter (e:Event) {
real_txt.text = box_mc.x.toString();
//server_txt.text = //
};
function onMDown (e:MouseEvent) {
var o:Object = {px:box_mc.x};
smartfox.sendObject(o);
smartfox.sendPublicMessage('don rules');
box_mc.startDrag(false);
};
function onMUp (e:MouseEvent) {
box_mc.stopDrag();
};
stop();
for debugging I've also sent a public message along with my object, and this works handsomely. I've also checked the server administrator for data-in, I know that hitting refresh on the server-admin will increase your data-input, but it looks like the object is definitely coming in as well.
I'm not using the .swc, because I couldn't get that to install correctly. Instead I'm using the free download for smartfoxserver pro and the as3 api that lapo posted at http://forums.smartfoxserver.com/viewtopic.php?t=1424
Any help or insight would be GREATLY appreciated. Thank you.
/*the classes have been imported on frame1, and all the connections have been made on that frame as well. */
smartfox.addEventListener(SFSEvent.onAdminMessage, onAdminMessage);
smartfox.addEventListener(SFSEvent.onObjectReceived, onObj);
smartfox.addEventListener(SFSEvent.onPublicMessage, onPublicMessage);
box_mc.addEventListener(MouseEvent.MOUSE_DOWN, onMDown);
box_mc.addEventListener(MouseEvent.MOUSE_UP, onMUp);
box_mc.addEventListener(Event.ENTER_FRAME, onEnter);
function onAdminMessage (e:SFSEvent) {
admin_txt.text = e.params.message;
};
function onObj (e:SFSEvent):void {
trace ('something here!');
trace (e.params);
//server_txt.text = e.params.obj.px;
//server_txt.text = (e.params.message);
};
function onPublicMessage (e:SFSEvent) {
server_txt.appendText(e.params.message)
};
function onEnter (e:Event) {
real_txt.text = box_mc.x.toString();
//server_txt.text = //
};
function onMDown (e:MouseEvent) {
var o:Object = {px:box_mc.x};
smartfox.sendObject(o);
smartfox.sendPublicMessage('don rules');
box_mc.startDrag(false);
};
function onMUp (e:MouseEvent) {
box_mc.stopDrag();
};
stop();