hi Lapo,
I'm learning to write some multi-user application using the SFS socket server. Your documents is good and easy to understand, but when I tried to wrote some simplest code I found it didn't work. can you help me to see where is the mistake I've written?
// setting variables
move = new Object();
move.px = 100;
move.py = 200;
// action on a buttons called test_btn
on (release) {
smartfox.sendObject(move)
}
// receive object event
// there are 2 dynamic texts called test_text_x , test_text_y
// and a mc called test_mc
smartFox.onObjectReceived = function(obj:Object, user:User)
{
test_text_x.text = user.getVariable("px")
test_text_y.text = user.getVariable("py")
test_mc._x = user.getVariable("px")
test_mc._y = user.getVariable("py")
trace("User: " + obj.getName() + " is now located at " + px + ", " + py)
}
as you can see, most of the codes are copied from your tutorial.
I added these codes to the pro_smartFoxTris.fla game scene.
I opened 2 swf to test put the functions
as a result, when I pressed the button, the output windows trace something have been sent or recieved, but the texts and the postion of test_mc didn't moved. what's wrong with my code?
==============================================
also, I'm trying to put the application inside a website. Is it possible to get the login and password from the database so that it don't need to login in again after I login to the website?
a few questions from newbies.
Quickly:
1) you use both smartfox and smartFox for the same variable... that can be a problem if you use Actionscript 2.0 and in general is a mistake. Please decide which way you want to call that variable and use just one name
2) Why do you use getVariable() in the function that handles the object?
The 1st obj parameter in the onObjectReceived function IS the object sent by the other user!
The code should look like this:
1) you use both smartfox and smartFox for the same variable... that can be a problem if you use Actionscript 2.0 and in general is a mistake. Please decide which way you want to call that variable and use just one name
2) Why do you use getVariable() in the function that handles the object?
The 1st obj parameter in the onObjectReceived function IS the object sent by the other user!
The code should look like this:
Code: Select all
smartFox.onObjectReceived = function(obj:Object, user:User)
{
test_text_x.text = obj.px
test_text_y.text = obj.py
test_mc._x = obj.px
test_mc._y = obj.py
}
thanks again for ur informations.
Now I've setuped the SFS on my server, going on to the applications.
I edited form the SimpleChat.fla. when I published it (with the server IP and port) and run the swf in my PC it functioned normally, but when I put the swf on the web, it could not be connected. I wonder if the file should place under a specific place?
Now I've setuped the SFS on my server, going on to the applications.
I edited form the SimpleChat.fla. when I published it (with the server IP and port) and run the swf in my PC it functioned normally, but when I put the swf on the web, it could not be connected. I wonder if the file should place under a specific place?
This is the most common problem that arises when it's time to publish something on the web.
The flash player has security restrictions when used in the web browser and you should understand them.
Please read this post >> viewtopic.php?t=73
Also if you search for "player restriction" in this board you can find many discussion about this topic.
The flash player has security restrictions when used in the web browser and you should understand them.
Please read this post >> viewtopic.php?t=73
Also if you search for "player restriction" in this board you can find many discussion about this topic.
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 50 guests