cannot access room variables

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

Moderators: Lapo, Bax

Post Reply
ediver
Posts: 20
Joined: 05 Jul 2011, 16:28

cannot access room variables

Post by ediver »

i create some users variables from the client using as3..from the admin panel i can see these variables but cannot access them from flash..
for example one var called creator and it is string

this line room.containsVariable("creator") answer false...why?
i can't access these variables outside from the ROOM_VARIABLES_UPDATE event?
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. Do you try to access these variables only after the ROOM_VARIABLES_UPDATE event? Also can you access these variables inside this event?
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.
ediver
Posts: 20
Joined: 05 Jul 2011, 16:28

Post by ediver »

no nothing from these options..
but i find that i can use a variable if set it as global...
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Well, if you're trying to get a variable from a room that isn't the one you're joined into, then yes, you need to set the variable as global, otherwise it wont be visible from players outside that room (i think they need to be at least in the same room group as that room to be able to get the variables).

Sorry, from your first post i didn't realize you were accessing those vars from an external room...
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.
ediver
Posts: 20
Joined: 05 Jul 2011, 16:28

Post by ediver »

no no..i want to access the variables into the same room.. but i can't...
and i find this solution (with global variable) but i know that isn't right.. and i can't set global variable from the client ..so i want to solve this problem...
the mystery is that the variable is created because i find it to the admin panel.. i try to fire the ROOM_VARIABLES_UPDATE event and try after that..
ediver
Posts: 20
Joined: 05 Jul 2011, 16:28

Post by ediver »

oh my god... i find it... i use gotoAndStop(10) before call the JoinRoom Funtion and the code of using the variables was to the frame 10.. so the playhead go first to the frame and cannot find the variables and after join the room..
thanks for your reply
Post Reply