Cocoonjs Textbox workaround

Get help using Construct 2

Post » Thu Nov 28, 2013 9:28 am

Since cocoonjs cant render form items

I read a workaround using the Cocoonjs object keyboard text input
somehow can be used.. my problem is to post the player name to highscore


please see my dump here

the form input = txtPlayerName_input work with the ajax
So how do get it to work with the Cocoonjs object



Regards
Flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Thu Nov 28, 2013 10:26 am

Global Variable PlayerName=""

Add condition:
-CocoonJS on input ok
Add Action:
-Set PlayerName to CocoonJS.InputText

then when ajax-ing, use PlayerName.

Should be what you want.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Nov 28, 2013 10:41 am

Thanks for reply !!

Can you help me with the ajax-thing ?

savescores.php?name=" & txtPlayerName_input.Text & "&score=" & Score
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Thu Nov 28, 2013 10:49 am

In CocoonJS they don't support textbox. So the textbox object is not created. So instead of using textbox.text, change it to PlayerName variable.

savescores.php?name=" & PlayerName & "&score=" & Score
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Thu Nov 28, 2013 11:57 am

Great.. thanks again

It works... but the input window on the phone dont close after hitting OK
it clear the textfield and I have to hit OK 2 or 3 times

and it seams to post the extra hits as you can see





Am I missing something ?
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Fri Nov 29, 2013 2:46 am

Touch is touching will trigger every tick. so it will call the prompt a few times.

Change your "Touch is touching" to "Touch on touched object". For both Submit and txtPlayerName.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Nov 29, 2013 10:58 am

Ohh Yes I see ... Thanks :-)
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Sun Dec 01, 2013 9:22 am

Heyy .. Glad you helped me out here :-)

I has another issue - How do I avoid that a player post more than one time

Peter 550
Peter 420

But only shows once

Peter 550


Have a nice day
flemming


B
33
S
17
G
11
Posts: 350
Reputation: 8,695


Return to How do I....?

Who is online

Users browsing this forum: TRMG and 31 guests