Access of possibly undefined property onExtensionResponse

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

suvroz
Posts: 12
Joined: 16 Mar 2010, 09:37

Access of possibly undefined property onExtensionResponse

Postby suvroz » 18 Mar 2010, 02:33

I am trying to compile this piece of code:

import it.gotoandplay.smartfoxserver.*;
import it.gotoandplay.smartfoxserver.data.*;

var smartfox:SmartFoxClient=new SmartFoxClient(true);
var extensionName:String="mydb";
butt_load.addEventListener("click", getData);
function getData() {
smartfox.sendXtMessage(extensionName, "getData", {}, "xml");
}
smartfox.onExtensionResponse = function(resObj:Object, type:String)
{
// We expect the response to be xml formatted
if (type == "xml")
{
// Let's check if it's a "getData" message
if (resObj._cmd == "getData")
{
// Cycle through the "db" object sent by
// the server and add it to the datagrid for visualization
for (var i = 0; i < resObj.db.length; i++)
{
/////grid_dg.addItem(resObj.db[i])
trace(debug_txt.text+=" query "+resObj.db[i])
}
}
}
}


it is showing some error. is it due to some missing class file?

1119: Access of possibly undefined property onExtensionResponse through a reference with static type it.gotoandplay.smartfoxserver:SmartFoxClient.





Suvroz :roll:
User avatar
Lapo
Site Admin
Posts: 21726
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Mar 2010, 07:56

You must be certain that your Flash/Flex classpath is correctly pointed to the SmartFoxServer classes, or your imports won't work.
Take a look here:
http://www.smartfoxserver.com/docs/docP ... alling.htm
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 28 guests