login without loginbox help

Everything about the SmartFoxBits UI Components for SmartFoxServer 1.x. Post your questions, suggestions and bug reports.

Moderators: Lapo, Bax

kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

login without loginbox help

Postby kenjii » 16 Mar 2009, 20:55

hello all


but i'am noob and try since 1 week.....

For my game i'am using the lobby file, i have already modify it for get username, userid and playerid from the connector.

But now i want to login without login box or without entered name on swf.

i have a website in php where user can already login for see them account.

i have try to do like in the yathzee file with the "sendLogin"

Code: Select all

smartfox.login(zone, login_txt.text, null)


And here is my probleme it don't work....i have try like this

Code: Select all

connector_mc.login(zone, login_txt.text, null)


and by many other but no result

can somebody help me ?

sorry for my bad english
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 Mar 2009, 07:23

Check the documentation of the Connector.connection property: you will find the exact example of what you are trying to do.
The problem in your code above is that you are trying to call the login method on the Connector instance, which doesn't have such method. You have to retrieve the Connector's internal instance of the SmartFoxClient.[/code]
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 17 Mar 2009, 10:02

hello i have take a look to the doc and try to made test from this

but i still have problem .

I'am a noob sorry .....

when i put the connector and the code on the frame

Code: Select all

import it.gotoandplay.smartfoxserver.*

var smartFox:SmartFoxClient = connector.connection
var zone:String = "simpleChat"
var myUserName:String = "Jack"
// Log into the "simpleChat" zone without using the LoginBox component
smartFox.login(zone, myUserName)



This line give me an error :
var smartFox:SmartFoxClient = connector.connection

it's saying me that :

WARNING! The API you are using are not compatible with
the SmartFoxServer you're trying to connect to.

the error is from " connector.connection".

that i don't understand here is why API is not good...

i have try from yathzee tutorial file and it work fine .

can you help me for this ?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 Mar 2009, 13:07

Which version of SmartFoxServer are you using?
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 17 Mar 2009, 20:16

i have smartfox server Pro

because for me only version pro work's on my minux fedora server.

But file like lobby, yahtzee work fine

i use :
#include "SmartFoxClient.as"

and

import it.gotoandplay.smartfoxbits.events.*
import it.gotoandplay.smartfoxserver.*
import mx.utils.Delegate

and i use too only the connector like as in the video tutorial
all is working

only here don't work...
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 17 Mar 2009, 20:26

I mean: 1.6.1, 1.6.2 ecc.
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 17 Mar 2009, 21:11

ho ok sorry ...

it's 1.6.2 i don't have already try to install the 1.6.5 realese
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 18 Mar 2009, 08:07

kenjii wrote:i use :
#include "SmartFoxClient.as"

No need to add this statement.
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 18 Mar 2009, 09:14

yes i know but it's in the tutorial file of yahtzee and work fine so i try with i'am nooby :)

but my problem is still here always the same error message

have you an idea?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 18 Mar 2009, 10:33

Please send us your fla file, so we can give it a look. You can send it to our contact email address.
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 18 Mar 2009, 11:19

ok i have send the fla file .

Hope this can help and thank's for all .
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 19 Mar 2009, 07:01

We checked your code, and there's a major issue.

Code: Select all

import it.gotoandplay.smartfoxbits.events.*
import it.gotoandplay.smartfoxserver.*
import mx.utils.Delegate

stop()
var vie = 100;

var smartFox:SmartFoxClient = connector.connection
var zone:String = "simpleChat" ;
var myUserName:String = "Jack" ;
// Log into the "simpleChat" zone without using the LoginBox component
smartFox.login(zone, myUserName)


// Register for onLogin event adding a listener to the connector instance,
// in order to go to the 'chat' screen when successful login occurs
connector_mc.addEventListener(SFSEvent.onLogin, Delegate.create(this, onLogin))

function onLogin(evt:SFSEvent):Void
{
   ...
};

In the same frame of the timeline where the Connector instance is added to the stage, you are trying to login. This is wrong: when the Connector instance is created, it must to establish a connection with SmartFoxServer before you can try to login, and this is not immediate.
You will have to add a listener for the onConnection event to the Connector, and only after a successful connection you can login.
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 19 Mar 2009, 20:57

i have do the connection of the connector here is no problem

But i have another "problem"i don't know why it don't login me

i use the code for connection

Code: Select all

import it.gotoandplay.smartfoxserver.*
import it.gotoandplay.smartfoxbits.events.*
stop();
var zone:String = "simpleChat"
var myUserName:String = "Jack"
connector_mc.addEventListener(SFSEvent.onConnection, onConnectionHandler)
function onConnectionHandler(evt:SFSEvent): Void
    {        if (evt.params.success)
           {    trace("Great, successfully connected!")      

// Log into the "simpleChat" zone without using the LoginBox component
smartFox.login(zone, myUserName)}}

connector.addEventListener(SFSEvent.onLogin, Delegate.create(this, onLogin))
function onLogin(evt:SFSEvent):Void
{   var response:Object = evt.params.resObj
         if (response.success)
         {      gotoAndStop("chat")}
}


i have the trace("Great, successfully connected!")
but it don't let me go on fram "chat" after login.
i have try many other but no result again...

Can you help me again ?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 20 Mar 2009, 07:48

It is not working because you are adding the onLogin event listener to "connector" instead of "connector_mc".
Paolo Bax
The SmartFoxServer Team
kenjii
Posts: 27
Joined: 06 Mar 2009, 12:33
Location: france

Postby kenjii » 20 Mar 2009, 09:45

i'am very sorry but still not working

i have change the "connector" name and it still don't work .

i have try to change the "smartFox.login(zone, myUserName)" to connector_mc.login , no one of this work i have try connector_mc.connection .login

and many other , nothing of i have do seem to work i never go on frame chat and login name is undefined .

Have you another idea ?

Return to “SmartFoxBits for SFS 1.x”

Who is online

Users browsing this forum: No registered users and 12 guests