Error in the extenstion

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

hyuval1511
Posts: 13
Joined: 17 Oct 2011, 14:57

Error in the extenstion

Postby hyuval1511 » 04 Sep 2013, 15:12

hello
i get this error i hope you can help me

Code: Select all

[registerFloopWorld.as]: Hello
org.mozilla.javascript.EcmaError: ReferenceError: "handleRequest" is not defined
. (registerFloopWorld.as#994)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
17:36:22.569 - [ WARNING ] > Error in extension [ registerFloopWorld.as ]: ReferenceError: "handleRequest" is not defined. (registerFloopWorld.as#994) Internal:
 -581 -- Line number:  (MainLib line: 994)


the Extension code

Code: Select all

var dbase;

function init(){
        trace("Virtual World Extension Loaded");
        dbase = _server.getDatabaseManager();
}

function destroy(){
        trace("Virtual World Extension Destroyed");
}

function sendResponseBack(obj, user){
        var userList = [];
        userList.push(user);
        _server.sendResponse(obj,-1,null,userList);
}
function handleInternalEvent(evt){
   trace ("Hello")
   //not used }
function handleRequest(cmd, params, user, fromRoom){
trace("starting registration proccess")
      var userName = params.uName;
      var passWord = params.pass;
      
      var response = {_cmd:cmd };
      var error = "";
      var success = false;
      
      var sql = "SELECT COUNT (AVATAR_NAME) FROM USERS WHERE AVATAR_NAME='"+_server.escapeQuotes(userName)+"'";
      var queryRes = dbase.executeQuery(sql)
      
      if (queryRes != null){
         var Row = queryRes.get(0)
         var count = Row.getItem("COUNT(AVATAR_NAME)");
            
         if(count == 0){
            trace("USERNAME NOT REGISTERED, REGISTERING");
            sql = "INSERT INTO USERS (AVATAR_NAME, PASSWORD) VALUES ('" + userName + "', '" + passWord + "')";
            queryRes = dbase.executeCommand(sql);
            success = true;
         }else{
            trace("USERNAME ALREADY REGISTERED!")
            error = "The username entered is already registered.";
         }
      }else{
         error = "Error connecting to the database";
      }
      
      response.error = error;
      response.success = success;
      _server.sendResponse(response, -1, null, [user])} 
}


i am hope that someone can help me
T.Y
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Error in the extenstion

Postby Lapo » 04 Sep 2013, 15:44

The problem is in this line:

Code: Select all

   //not used }


This way the closed bracket is not detected because it is in the same commented line, therefore the function declaration is not closed and the next function is not recognized. Etc...

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

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 27 guests