ClassCastException trying to access room ext from zone ext

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: ClassCastException trying to access room ext from zone ext

Postby nik0990 » 24 Dec 2016, 08:55

Thanks for reply,

Thia method called when player join room event

Code: Select all

  public void handleJoinRequest(User user) {
    
    
     if(!userList.contains(user)){
        userList.add(user);
     }
     this.sendRoomDetails(user.getPlayerId());
     IThreePattiExtension ext =  (IThreePattiExtension) getParentZone().getExtension();//showing error
     Room room = getParentRoom();
     ext.joinGameRoom(user.getPlayerId(),  getParentRoom().getVariable("gameName").getStringValue());
     //add one Map that having playerid and list of rooms
     //send room data
  }
 


IThreePattiExtension is interface of zoneExtension
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ClassCastException trying to access room ext from zone ext

Postby Lapo » 24 Dec 2016, 09:11

Ok, so it's the problem I supposed.
I highly recommend to read the doc link I gave you.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: ClassCastException trying to access room ext from zone ext

Postby nik0990 » 24 Dec 2016, 09:41

Hi,

I already put all model files(dao,utils) class in __lib__ folder and I will example you my problem by one example.

Example:

- I have one ZOne extension and one room Extension class
- When i am accessing ZoneExtension from Room i am getting this error.
- Model file are already inside __lib__

I am getting error at this line:

ThreePattiExtension ext = (ThreePattiExtension) getParentZone().getExtension();
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: ClassCastException trying to access room ext from zone ext

Postby nik0990 » 24 Dec 2016, 10:20

Rooms are creating dynamically so i moved that part to __lib__ but still getting same issue.
nik0990
Posts: 76
Joined: 23 Dec 2016, 10:48
Location: India

Re: ClassCastException trying to access room ext from zone ext

Postby nik0990 » 24 Dec 2016, 10:44

Hi ,

Thanks, resolved and great doc

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 115 guests