Page 1 of 2

Chat bubble database error

Posted: 02 Jan 2013, 17:42
by zachofthegolden1
Hello,

I have connected my flash avatar chat action script 2 to a database it works and respond correctly. The problem is that the chat bouble doesent even show when i send messages. Other users can see my messages except the person who is sending it. I downloaded the new api from sfs website 1.6.9 this time other users can see messages and when i send a message it shows the bubble and says undefined for me but others users see the message i am sending. I have seached but cannot find a solution to this problem. Thank you for taking time to read this i am really stuck.

Also if i change custom login to false it works fine but when custom login is set to true it never works for the person sending the message but see able for the person who is receiving it

Re: Chat bubble database error

Posted: 06 Jan 2013, 04:28
by zachofthegolden1
Anyone?

Re: Chat bubble database error

Posted: 06 Jan 2013, 22:20
by zachofthegolden1
Done some Debugging and traces ok the user who is sending the message doesn't see the message displayed in the bubble

so i can see messages from other users but i cannot see mine as it says undefined to anyone sending the message


this is the debug

Code: Select all

[Sending]: <msg t='sys'><body action='pubMsg' r='75'><txt><![CDATA[324324]]></txt></body></msg>

[Received]: <msg t="sys"><body action="pubMsg" r="75"><user id="94" /><txt>324324</txt></body></msg>
UserObject -- [object Object]
user id 94
Message recieved from room The Hall
Name of sender: zachofthegolden

Re: Chat bubble database error

Posted: 07 Jan 2013, 01:36
by rjgtav
Hi,

I remember the ChatBubble having some issues with the timer which controls the amount of time it is shown. Please check its code.
Basically the error was that sometimes the interval wasn't cleared, so I suggest to add a clearInterval() before setting a new one.

Re: Chat bubble database error

Posted: 07 Jan 2013, 01:53
by zachofthegolden1

Code: Select all

function deactivate()
{
clearInterval(timer)
timer = setInterval(closeBubble, 8900)
}
 
function closeBubble()
{
bubble._visible = false

}



its always been that but if custom login is et to true bubbles are undefined for the client but other users messages are readable

Re: Chat bubble database error

Posted: 10 Jan 2013, 00:55
by rjgtav
hum.. If you trace the bubble it returns undefine d? And can you confirm that the instance name is correct?
If you open the default avatarChat that comes with sfs and enable the custom login feature, does that issue also happen?

Thanks

Re: Chat bubble database error

Posted: 10 Jan 2013, 13:44
by zachofthegolden1
If I was to set custom login to false the chat bubbles work perfectly but if i was to change custom login to true then the chat bubble shows but the text decides to say undefined for the client sending the message but if another use was in the room and they was to send a message you can read what they are sending.




Image

Re: Chat bubble database error

Posted: 12 Jan 2013, 00:42
by rjgtav
How are you setting the text message? Can you show the code you.re using?
And can that bug be reproduced on the default non-edited AvatarChat example?

Re: Chat bubble database error

Posted: 12 Jan 2013, 06:39
by zachofthegolden1
the coding is left how it is using the default it used to never even show the chat bubble until i downloaded the new api

Re: Chat bubble database error

Posted: 12 Jan 2013, 15:05
by rjgtav
And can this bug be reproduced on the default AvatarChat example? Can you confirm that?

Re: Chat bubble database error

Posted: 12 Jan 2013, 17:43
by zachofthegolden1
Yes i can confirm this

Re: Chat bubble database error

Posted: 16 Jan 2013, 00:13
by rjgtav
Allright. I'll try to reproduce and fix it tomorrow, and post the solution.
Sorry for the delay on the responses

Re: Chat bubble database error

Posted: 17 Jan 2013, 20:43
by zachofthegolden1
Don't worry about it lol we all got lives to live and stuff to do :)

Also this is mycode on frame 9 if this helps


Code: Select all

 import it.gotoandplay.smartfoxserver.*

#include "lib/[flashAPI].as"
#include "lib/easingEquations.as"
#include "lib/easing.as"

/*
* ----------------------------------------------------------------------------
*   [ Avatar Chat ] version 1.1.0 -- Actionscript 2.0
*   a SmartFoxServer sample application
*
*   www.smartfoxserver.com
*   (c) 2004 gotoAndPlay()
* ----------------------------------------------------------------------------
*/
stop()
Stage.showMenu = false


//----------------------------------------------------------
// Setup global variables
//----------------------------------------------------------
var stageW:Number = 780
var stageH:Number = 490

// hide semi-transparent panel
// used when a dialog box is shown
disabler._visible = false

// isBusy is true when the application
// is requiring input through a dialog box
// When true all other controls are temporarily disabled
_global.isBusy = false

// An event queue
var evtQueue:Array = []


//----------------------------------------------------------
// Setup global variables
//----------------------------------------------------------
//----------------------------------------------------------
// Setup global variables
//----------------------------------------------------------
showLogin(false)
showLoad(true)
status_txt.text = "Connecting To Server..."



//----------------------------------------------------------
// Server configuration
//
// ip    = IP address of the server, if the server is running
//         locally use 127.0.0.1
// port   = default value is 9339
// zone = the Server "zone" name for this application
//----------------------------------------------------------

var ip:String       = "yvgame.no-ip.org"
var port:Number    = 9339
var zone:String    = "dbZone"


var smartfox:SmartFoxClient = new SmartFoxClient()
smartfox.onConnection = handleConnection
smartfox.debug = true

// Connect to the server
smartfox.connect(ip, port)



//----------------------------------------------------------
// Handle connection response from server
//----------------------------------------------------------
function handleConnection(success:Boolean)
{
   if (success)
   {
      status_txt.text = "Activating Player..."
      showLogin(true)
      showLoad(false)
      butt_login.onRelease = sendLogin
   }
   else
   {
      status_txt.MovieClip = showWindow("connectFail")
   }
}


//----------------------------------------------------------
// Send login params to the server
// server.login(zone, nickName, password)
//----------------------------------------------------------
function sendLogin()
{
        if (!_global.isBusy)
        smartfox.login(zone, login_txt.text, pwd_txt.text)
}



//----------------------------------------------------------
// Handle login response from server
//----------------------------------------------------------
smartfox.onLogin = function(resObj:Object)
{
   if (resObj.success)
   {
      // Login Succesfull
      _global.myName = resObj.name
   }
   else
   {
      // Login Failed
      _gloabl.isBusy    = true
      
      // Show an error window
      var win:MovieClip = showWindow("loginError")
      win.errorMsg.text = resObj.error
   }
}
smartfox.onExtensionResponse = function(resObj:Object) {
 if (resObj._cmd == "logOK") {
  _global.myName = resObj.name;
  _global.coins = resObj.coins;
  _modlevel = resObj.modlevel;
  _global.isMod = resObj.isMod;
  col = resObj.pskin;
  smartfox.myUserName = resObj.name;
  smartfox.myUserId = resObj.id; //not sure if it is resObj.id
  userObj = resObj.id;
  smartfox.amIModerator = resObj.modlevel;
  mc.adminBadge._visible = true;
  smartfox.getRoomList();
 } else if (resObj._cmd == "logKO") {
  error.text = ""+resObj.err;
  status.text = "Connected";
  } if (resObj._cmd == "b4d") {
       gotoAndStop("banned");
 }
 
};
//----------------------------------------------------------
// Handle the onRoomListUpdate here and keep it in the
// queue. We'll handle it in the next frame.
//----------------------------------------------------------
smartfox.onRoomListUpdate = function(o:Object)
{
   evtQueue.push(o)
    gotoAndStop("chat");
    display.text = "Logged in as "+_global.myName;
};

//----------------------------------------------------------
// Handle unexpected server disconnection
//----------------------------------------------------------
smartfox.onConnectionLost = function()
{
   var win:MovieClip = showWindow("connectionLost")
      win.errorMsg.text = resObj.error
}



//----------------------------------------------------------
// Show / Hides the login input field and submit button
//----------------------------------------------------------
function showLogin(bool:Boolean)
{
   butt_login._visible = bool
   login_txt._visible = bool
   loginBox._visible = bool
   loginBox2._visible = bool
   pwd_txt._visible = bool
   modPass._visible = bool
   uName._visible = bool
   loginError2._visible = bool
   register_btn._visible = bool
   title._visible = bool
   
   if (bool)
      Selection.setFocus("login_txt")
}
function showLoad(bool:Boolean)
{
   loadBar._visible = bool
   
   
   if (bool)
      Selection.setFocus("login_txt")
}



//----------------------------------------------------------
// Shows a popup window and disables all other controls
//----------------------------------------------------------
function showWindow(linkageName:String):MovieClip
{
   _global.isBusy = true
   
   disabler._visible = true
   
   roomList_lb.setEnabled(false)
   userList_lb.setEnabled(false)
   
   var win = _root.attachMovie(linkageName, linkageName, 9999)
      
   win._x = (stageW / 2) - (win._width / 2)
   win._y = (stageH / 2) - (win._height / 2)
   
   return win
}



//----------------------------------------------------------
// Hides a popup window and re-enable the controls
//----------------------------------------------------------
function hideWindow(wName:String)
{
   this[wName].removeMovieClip()
   
   roomList_lb.setEnabled(true)
   userList_lb.setEnabled(true)
   
   disabler._visible = false
   _global.isBusy = false
}


 



I do think its something in ther eproberley causing it i have a chat log on the tutorials site by coolboy and the chat log works fine at saying whos saying what

Re: Chat bubble database error

Posted: 17 Jan 2013, 23:46
by rjgtav
Tomorrow I'll test enabling the customLogin on avatarChat with a simple extension that processes the login, to see how the Bubble is affected.
Next week I'll have more time again to come to the forums :)

Re: Chat bubble database error

Posted: 18 Jan 2013, 23:38
by rjgtav
Well, I edited the avatarCat.fla, added the necessary code for handling the custom login, created a simple extension which is responsible for handling the login, and everything's working as expected. So the custom login isn't the cause of the problem.
If the current client isn't showing the bubble, I'd say that you're having a problem accessing the client's avatar. Please double check your code