room.istemp alternative in 2x?

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

Moderators: Lapo, Bax

mixart
Posts: 95
Joined: 08 Aug 2007, 20:32

room.istemp alternative in 2x?

Postby mixart » 06 May 2012, 16:22

In SFS1 there was a room method called isTemp() that no longer exists in SFS2x — what is the alternate way to find out if a room is temporary or not?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: room.istemp alternative in 2x?

Postby rjgtav » 06 May 2012, 17:05

Hi.
In SFS1X a temp room was a room created by a player, not by the server. In SFS2X, on the client-side, there is no way to find whether a room was created by a player or by the server, but on the server-side you can know it by getting that room's owner (which returns null in case it was the server who created it).
That said, if you really need that feature, you could simply create a new global variable called, for example, "temp", which is true when that room was created by an user (you don't need to add that variable to the non-temp rooms). Please note that for creating a global variable, you have to create the room from the server-side.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
mixart
Posts: 95
Joined: 08 Aug 2007, 20:32

Re: room.istemp alternative in 2x?

Postby mixart » 06 May 2012, 18:24

Thanks (as always) :)
I did end up creating a room variable for this - does the job.

I put it down to just another one of those SFS1 to SFS2 differences.

I am a little disappointed how much more difficult things are in SFS2X. My AS code is about 200 lines larger so far, and my java extension - well that's about 300% the size it was in AS ;)
Hopefully these benefits are all worth it in the end.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: room.istemp alternative in 2x?

Postby rjgtav » 06 May 2012, 18:58

Yes they will. Remember AS3 and Java are much faster than AS2.0. And the new binary format beats the xml protocol by a huge difference ;)
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 8 guests