Error on kernel

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 28 May 2014, 16:09

Tomorrow I will try to rebuild the server side even with the new Java API. Download amy new site. Maybe this will help.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Error on kernel

Postby Lapo » 28 May 2014, 16:27

I don't follow. This is not a server side problem. Unless I have missed something else... :?:
Also not sure why you mention the Java API? The problem occurs in AS3...
Lapo
--
gotoAndPlay()
...addicted to flash games
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 29 May 2014, 07:47

I think maybe something wrong server sends the client, so the client is crashing
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Error on kernel

Postby Lapo » 29 May 2014, 07:56

According to the error you have reported it doesn't seem very likely.
In any case if you're going to reinstall the server let me know if it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 29 May 2014, 09:31

You were right. Rebuild of the server side (extension) has not helped. Here is a log from the console FB before the crash:

Code: Select all

[SFS - INFO] JoinRoom { Message id: 4 }
{ Dump: }

   (sfs_array) ul:
      (sfs_array)
         (int) 3
         (utf_string) Guest#3
         (short) 0
         (short) 1
         (sfs_array)
            (sfs_array)
               (utf_string) tm
               (byte) 2
               (int) 1
            
            (sfs_array)
               (utf_string) avatar
               (byte) 4
               (utf_string) avatar_Guest#3.jpg
            
            (sfs_array)
               (utf_string) un
               (byte) 4
               (utf_string) Guest#3
            
         
      
   
   (sfs_array) r:
      (int) 6
      (utf_string) Битва Guest#3 55015
      (utf_string) game
      (bool) true
      (bool) false
      (bool) false
      (short) 1
      (short) 16
      (sfs_array)
         (sfs_array)
            (utf_string) t2c
            (byte) 2
            (int) 0
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) map
            (byte) 4
            (utf_string) 1
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) t2
            (byte) 2
            (int) 2
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) usl
            (byte) 4
            (utf_string) 1
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) t1
            (byte) 2
            (int) 1
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) time
            (byte) 4
            (utf_string) 0
            (bool) false
            (bool) false
         
         (sfs_array)
            (utf_string) t1c
            (byte) 2
            (int) 0
            (bool) false
            (bool) false
         
      
      (short) 0
      (short) 0
   

ReferenceError: Error #1037: Cannot assign to a method map on Array.
   at com.smartfoxserver.v2.entities::SFSRoom/http://www.smartfoxserver.com/2X/kernel::merge()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/entities/SFSRoom.as:490]
   at com.smartfoxserver.v2.entities.managers::SFSRoomManager/replaceRoom()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/entities/managers/SFSRoomManager.as:98]
   at com.smartfoxserver.v2.controllers::SystemController/fnJoinRoom()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/controllers/SystemController.as:264]
   at com.smartfoxserver.v2.controllers::SystemController/handleMessage()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/controllers/SystemController.as:140]
   at com.smartfoxserver.v2.core::SFSProtocolCodec/dispatchRequest()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:150]
   at com.smartfoxserver.v2.core::SFSProtocolCodec/onPacketRead()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSProtocolCodec.as:54]
   at com.smartfoxserver.v2.core::SFSIOHandler/handlePacketData()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSIOHandler.as:252]
   at com.smartfoxserver.v2.core::SFSIOHandler/onDataRead()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/core/SFSIOHandler.as:111]
   at com.smartfoxserver.v2.bitswarm::BitSwarmClient/onSocketData()[/Users/Paolo/gotoAndPlay/gotoAndPlay/SmartFoxServer2X/API/AS3/src/com/smartfoxserver/v2/bitswarm/BitSwarmClient.as:456]
warning: unable to bind to property 'name' on class 'com.smartfoxserver.v2.entities::SFSRoom' (class is not an IEventDispatcher)
[Выгрузка SWF] E:\Storm\SFSTris2X\bin-debug\SFSTris2X.swf

Most likely it is in error JoinRoom
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 29 May 2014, 09:40

Server side UserJoinHandler:
addEventHandler(SFSEventType.USER_JOIN_ROOM, OnUserJoinHandler.class);

Code: Select all

public class OnUserJoinHandler extends BaseServerEventHandler
{
    @Override
   public void handleServerEvent(ISFSEvent event) throws SFSJoinRoomException
   {
      Room gameRoom = (Room) event.getParameter(SFSEventParam.ROOM);

      User user = (User) event.getParameter(SFSEventParam.USER);
      trace("==============================================================================================================");      
      trace("=========================================================JOIN ROOM===============================");
           if (gameRoom.getName().equals("The Lobby")==false)
           {
                 int team = user.getVariable("tm").getIntValue();
                 if((team==1 && gameRoom.getVariable("t1c").getIntValue()>= gameRoom.getMaxUsers()/2-2) ||
                    (team==2 && gameRoom.getVariable("t2c").getIntValue()>= gameRoom.getMaxUsers()/2-2) )
                 {
                    trace("teamFull" + user.getName());               
                 }
                 else
                 {
                    if(team==1)
                    {
                       RoomVariable var = new SFSRoomVariable("t1c", gameRoom.getVariable("t1c").getIntValue()+1);
                       List<RoomVariable> listOfVars = new ArrayList<RoomVariable>();
                       listOfVars.add(var);            
                       SmartFoxServer.getInstance().getAPIManager().getSFSApi().setRoomVariables(user, gameRoom, listOfVars);                       
                    }
                    else
                    {
                       RoomVariable var = new SFSRoomVariable("t2c", gameRoom.getVariable("t2c").getIntValue()+1);
                       List<RoomVariable> listOfVars = new ArrayList<RoomVariable>();
                       listOfVars.add(var);            
                       SmartFoxServer.getInstance().getAPIManager().getSFSApi().setRoomVariables(user, gameRoom, listOfVars);                                              
                    }
                 }
           }
   }
}
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 29 May 2014, 09:53

Replaced AutoJoin in

Code: Select all

sfs.send( new CreateRoomRequest(settings, true, sfs.lastJoinedRoom) )

by

Code: Select all

sfs.send( new CreateRoomRequest(settings, false, sfs.lastJoinedRoom) )

Error removed.
Problem exactly Join Room
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Error on kernel

Postby Lapo » 29 May 2014, 16:58

I still have no idea why this is happening to you.
I can do the same with any of the Example apps we provide and there's no problem, regardless of the autojoin flag.

Also I have tested running a similar server-side handler that listens for the User join and updates three Room Variables. No problems there either.

I still think it would be best if you could send us a bare-bone project that demonstrate the issue, so we can take a look.

p.s. = In the server side code you don't need to use this monstrously long lines...

Code: Select all

SmartFoxServer.getInstance().getAPIManager().getSFSApi().setRoomVariables(...)

Just use:

Code: Select all

getApi().setRoomVariables(...)

It works in any Extension, Request handler and Event handler :)
Lapo

--

gotoAndPlay()

...addicted to flash games
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 03 Jun 2014, 11:12

Send Stripped project to PM
Lucas
Posts: 27
Joined: 29 Jul 2011, 08:04

Re: Error on kernel

Postby Lucas » 09 Jun 2014, 09:24

Thank you very much!

The error can be easily reproduced with this small snippet:

var arr:Array = []
arr["map"] = 1000

The problem is that "map" is already a method in the Array class and cannot be reassigned. I suppose you are calling one of your variables "map" which in turn causes the exception.
Just changing the name will avoid the problem.

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 30 guests