Server Variable

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

Moderators: Lapo, Bax

Ceciaman
Posts: 45
Joined: 13 Feb 2009, 11:35

Server Variable

Postby Ceciaman » 08 Aug 2020, 13:20

ServerSide: javascript

I create a RoomVariable "X" with code:
var x=new SFSRoomVariable("X",valuestring);
x.setGlobal(false);
Arrays=[x];
getApi().setRoomVariables(null, room, Arrays,false,false,false,true);
..and all is Ok it appear on Room variables in Admin Panel

now how can i call it from serverside, when i need later?

T's
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Variable

Postby Lapo » 08 Aug 2020, 17:58

Hi,
from the Zone object you can get the Room ( getRoomById() or getRoomByName() )
With the Room you can get the variable via getRoomVariable(name)

In other words:

Code: Select all

var room = getParentZone().getRoomByName("myRoom");
var roomVar = room.getVariable("varName");


Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Bing [Bot] and 146 guests