Forum QuickConnect simpleRegister

Discussion and help relating to PlayerIO's QuickConnect feature, including Facebook Connect and Kongregate Connect.

simpleRegister

Postby mstudios » April 4th, 2013, 3:05 am

So I've been trying to get this simpleRegister thing to work for AGES. Every time I ask anyone for help they say "look at the examples" but there aren't any examples using simpleRegister...or any that I can see. My issue is that I have no clue where to stick this snippet of code thats in the documentation. I've got the input fields created, but its linking those to the playerio framework that throws me for a loop. i tried naming the fields username, password, and email respectively, but i get erros in flash when doing that... Implicit corsions of String and textfield..
any ideas or examples, perhaps, of someone who has implemented this? This is pretty much the missing link that I need to get my project rolling full steam ahead. I'd hate to leave playerIO simply because i can't get this to work :/ it's the most straight forward backend solution I've found...and its the best (so far).

please help
mstudios
 
Posts: 8
Joined: November 24th, 2012, 1:54 am

Re: simpleRegister

Postby Henrik » April 4th, 2013, 9:15 am

When the user clicks your register button in the form you made, you need to read the values that the user entered, check that the user actually entered something, and then pass the values into the simpleRegister method. Not the textfields themselves, that's what your error message means, but the strings the user wrote.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: simpleRegister

Postby Kalinium » April 4th, 2013, 1:51 pm

mstudios wrote:i tried naming the fields username, password, and email respectively, but i get erros in flash when doing that... Implicit corsions of String and textfield..


Instead of passing username, password and email, you should (probably) be passing username.text, password.text and email.text

username is a reference to the textbox, which is an object with lots of properties like width and height, so if you pass that to simpleRegister it doesn't know what you mean. The "text" property is simply what's in the textbox, so if you need to pass that instead.
Kalinium
 
Posts: 18
Joined: October 16th, 2012, 2:58 pm

Re: simpleRegister

Postby mstudios » April 4th, 2013, 6:18 pm

Kalinium wrote:
mstudios wrote:i tried naming the fields username, password, and email respectively, but i get erros in flash when doing that... Implicit corsions of String and textfield..


Instead of passing username, password and email, you should (probably) be passing username.text, password.text and email.text

username is a reference to the textbox, which is an object with lots of properties like width and height, so if you pass that to simpleRegister it doesn't know what you mean. The "text" property is simply what's in the textbox, so if you need to pass that instead.

*slaps forehead* that moment in life where you realize the error you got was something simple. perhaps I'm closer than I think to solving this? Thanks for the input guys :D

Edit:
That got me farther than I was :D! Thank you so much. I think the big issue I was having was I had the code snippet:
Code: Select all
function register(e:Event):void{
   PlayerIO.quickConnect.simpleRegister(
   stage,
   'blah blah blah',
   username.text,
   password.text,
   email.text,
   null, // captcha key, if captcha is used
   null, // captcha value, if captcha is used
   {gender:'male',age:99}, // any additional data you want
    null, function(e:PlayerIORegistrationError):void{
        trace("Error: ", e)
    }
);

but I wasn't sure if it went into the main timeline where I would normally put code for a button or if I had to do it from the MyGame.as file that had all of the playerIO connection info...got very confused.

I think the only question I have left is...should the game be connected to the server prior to me actually logging in with login credentials? i.e. should I get this output before or after the user has logged in?:
Code: Select all
Player with the userid 1 just joined the room
Recived the message [playerio.Message]
type:      UserJoined
length:      1
content:   Id   Type      Value
         ---------------------
         0   int         1
mstudios
 
Posts: 8
Joined: November 24th, 2012, 1:54 am

Re: simpleRegister

Postby Henrik » April 4th, 2013, 10:03 pm

mstudios wrote:I think the only question I have left is...should the game be connected to the server prior to me actually logging in with login credentials? i.e. should I get this output before or after the user has logged in?:

It's impossible to do it in the wrong order...

When you call Connect or SimpleConnect, you get back a Client object. On that object you can then call client.multiplayer.joinRoom, which joins the connected user to a multiplayer room, and returns a Connection object, on which you can then attach message handlers and send messages.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to QuickConnect