12 errors of Access of undefined property, all having to do with User Variables.

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

Moderators: Lapo, Bax

Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

12 errors of Access of undefined property, all having to do with User Variables.

Postby Ninjaoninja2 » 26 Dec 2016, 19:00

Hello,

I am very frustrated and tired with this code, I have tried looking everywhere nobody seems to be getting the same error as me. I keep getting 12 errors no matter what I do all saying relatively the same thing here there are:

Code: Select all

Scene 1, Layer 'game', Frame 2, Line 8, Column 38   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 8, Column 81   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 10, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 11, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 12, Column 26   1120: Access of undefined property AVATAR_DIRECTIONS.
Scene 1, Layer 'game', Frame 2, Line 21, Column 23   1180: Call to a possibly undefined method SFSUserVariable.
Scene 1, Layer 'game', Frame 2, Line 21, Column 39   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 22, Column 23   1180: Call to a possibly undefined method SFSUserVariable.
Scene 1, Layer 'game', Frame 2, Line 22, Column 39   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 23, Column 23   1180: Call to a possibly undefined method SFSUserVariable.
Scene 1, Layer 'game', Frame 2, Line 23, Column 39   1120: Access of undefined property USERVAR_DIR.
Scene 1, Layer 'game', Frame 1, Line 16, Column 54   1120: Access of undefined property onUserVarsUpdate.


Here's my User Variable code:

Code: Select all

import    com.smartfoxserver.v2.requests.*
function onRoomJoin(evt:SFSEvent):void
{
     
    // Create current user's avatar by setting its position user variables to a random value
    // This is required the first time only, because we are not clearing user position
    // when the room is changed
    if (!sfs.mySelf.containsVariable(USERVAR_X) && !sfs.mySelf.containsVariable(USERVAR_Y))
    {
        var px:int = Math.round(Math.random() * panel_chat.avArea.width)
        var py:int = Math.round(Math.random() * panel_chat.avArea.height)
        var dir:String = AVATAR_DIRECTIONS[2]
         
        setAvatarVariables(px, py, dir)
    }
}
 
function setAvatarVariables(px:int, py:int, dir:String):void
{
    var userVars:Array = [];
    userVars.push(new SFSUserVariable(USERVAR_X, px));
    userVars.push(new SFSUserVariable(USERVAR_Y, py));
    userVars.push(new SFSUserVariable(USERVAR_DIR, dir));
     
    sfs.send(new SetUserVariablesRequest(userVars));
}


Oh AND if I import com.smartfoxserver.v2.entities.variables it gives me additional errors.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: 12 errors of Access of undefined property, all having to do with User Variables.

Postby Lapo » 26 Dec 2016, 19:09

Hi,
are you sure you have linked the swc to your project? Make sure you've followed the directions found here:
http://docs2x.smartfoxserver.com/Gettin ... nt-api-as3

Also many of the referenced names in the 12 errors you have reported have nothing to do with the SFS API, so there must be something else going on with your current project setup.

Namely these errors are not related to SFS2X API:

Code: Select all

Scene 1, Layer 'game', Frame 2, Line 8, Column 38   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 8, Column 81   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 10, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 11, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 12, Column 26   1120: Access of undefined property AVATAR_DIRECTIONS.
Scene 1, Layer 'game', Frame 2, Line 21, Column 39   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 22, Column 39   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 23, Column 39   1120: Access of undefined property USERVAR_DIR.
Lapo
--
gotoAndPlay()
...addicted to flash games
Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Re: 12 errors of Access of undefined property, all having to do with User Variables.

Postby Ninjaoninja2 » 26 Dec 2016, 22:46

Lapo wrote:Hi,
are you sure you have linked the swc to your project? Make sure you've followed the directions found here:
http://docs2x.smartfoxserver.com/Gettin ... nt-api-as3

Also many of the referenced names in the 12 errors you have reported have nothing to do with the SFS API, so there must be something else going on with your current project setup.

Namely these errors are not related to SFS2X API:

Code: Select all

Scene 1, Layer 'game', Frame 2, Line 8, Column 38   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 8, Column 81   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 10, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 11, Column 49   1120: Access of undefined property panel_chat.
Scene 1, Layer 'game', Frame 2, Line 12, Column 26   1120: Access of undefined property AVATAR_DIRECTIONS.
Scene 1, Layer 'game', Frame 2, Line 21, Column 39   1120: Access of undefined property USERVAR_X.
Scene 1, Layer 'game', Frame 2, Line 22, Column 39   1120: Access of undefined property USERVAR_Y.
Scene 1, Layer 'game', Frame 2, Line 23, Column 39   1120: Access of undefined property USERVAR_DIR.

Thanks I fixed them but the main issue that brought me here was I can't get the avatars to show up.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: 12 errors of Access of undefined property, all having to do with User Variables.

Postby Lapo » 27 Dec 2016, 11:02

Which avatars exactly?
Are you referring to our "Avatar Chat example": http://docs2x.smartfoxserver.com/Exampl ... vatar-chat
or something else?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Ninjaoninja2
Posts: 204
Joined: 22 Sep 2013, 23:33

Re: 12 errors of Access of undefined property, all having to do with User Variables.

Postby Ninjaoninja2 » 27 Dec 2016, 16:21

Lapo wrote:Which avatars exactly?
Are you referring to our "Avatar Chat example": http://docs2x.smartfoxserver.com/Exampl ... vatar-chat
or something else?

Thanks

I'm building my own MMO with my own avatars and I'm not exactly sure on how to get them to show on the stage and have that work with the User Variables.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: 12 errors of Access of undefined property, all having to do with User Variables.

Postby Lapo » 28 Dec 2016, 09:27

I would recommend to take a look at the "Simple MMO World" example to get started:
http://docs2x.smartfoxserver.com/Exampl ... simple-mmo

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 103 guests