Input text

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

44 Replies - 3917 Views - Last Post: 24 January 2009 - 12:06 PM

#1 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Input text

Posted 05 January 2009 - 06:21 PM

I am creating a flash game where the user inputs a name, that they want thier character to be called. I know this is possible because I've seen it in other flash games. So what code would it requre to record that name in the computer's memory and write there name on the screen when playing? If you know please help. ALL HELP GREATLY APPRECIATED! :)
Is This A Good Question/Topic? 0
  • +

Replies To: Input text

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 05 January 2009 - 08:27 PM

Create a shared object that stores the user input on name. That way you can access it whenever and all that jazz. As for displaying it, just create a TextField (this can be done through AS or just by creating a new text block and setting it as dynamic text). You can access TextField's text attribute like so:
TEXT_FIELD_NAME.text = "Something";


HTH
Was This Post Helpful? 0
  • +
  • -

#3 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 06 January 2009 - 05:28 PM

OK I'm cofused. I have a text box that you input the name and a that's a few frames later that displays the text you wrote which box do I put that code in?? :)
Was This Post Helpful? 0
  • +
  • -

#4 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 06 January 2009 - 05:31 PM

The code above will go in the second one.
Was This Post Helpful? 0
  • +
  • -

#5 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 06 January 2009 - 06:31 PM

Sorry that I'm pestering you so much, but how do I make a shared object that records what the user types in?
Was This Post Helpful? 0
  • +
  • -

#6 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 06 January 2009 - 06:40 PM

Okay, so you create a new shared object, (ex: http://www.dreaminco...wtopic78882.htm ). Then you need to have your input text, and an event that you are waiting for for the user to say that they are done entering their name. Once that event happens, create the shared object and save the name to it, using something like
INPUT_TEXT.text
to get the input name of the character and place it in a shared object variable.

After that you can go about checking if the shared object is already in existance, if it is you don't have to worry about much, and can skip over the user input name part.

The topic above also has an example of how to read out shared object variables, so you could just get the name back and place it in the textbox, using the code (modified of course) that I posted above in the topic.

Hope that makes sense.
Was This Post Helpful? 0
  • +
  • -

#7 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 06 January 2009 - 07:05 PM

I can't upload my file why??I know I'm so close. But I still can't do it. Here's my code.
onClipEvent (unload) {
var dat:SharedObject = SharedObject.getLocal("file");
if (dat.data.t) {
	trace(dat.data.t);
} else {
	dat.data.t = "INPUT_TEXT.text";
}}
What's wrong this is the code that is supposed to record what the user put's in.

This post has been edited by Glorfindal: 06 January 2009 - 07:11 PM

Was This Post Helpful? 0
  • +
  • -

#8 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 06 January 2009 - 08:05 PM

The problem is that you have the quotes around INPUT_TEXT.text, it needs to look like so:

 dat.data.t = INPUT_TEXT.text;



And the input textbox needs to have the instance name of INPUT_TEXT

As for not being able to upload the file, it is for security reasons. If you save a copy of it and then change the file extension from .fla to .txt you will be able to upload the file. (Then again, you may not have enough posts to be allowed to upload files, but if you can see the file upload stuff, I believe you can upload files, just some extensions aren't allowed).

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#9 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 08 January 2009 - 05:16 AM

OK, i zipped the file. And uploaded it. Now could you download it and find what's up?

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#10 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 08 January 2009 - 09:04 PM

It appears that the zip is not valid or has been messed up on upload. Could you try to re-attach it?
Was This Post Helpful? 0
  • +
  • -

#11 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 10 January 2009 - 12:03 PM

OK, I uploaded it to my Website. Just Click the 'download' button to dowload it.
DOWNLOAD

This post has been edited by Glorfindal: 10 January 2009 - 12:09 PM

Was This Post Helpful? 0
  • +
  • -

#12 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 10 January 2009 - 05:44 PM

Okay, I have got it to work with te user name stuff. Here is the file (saved as .txt, all you have to do is change it to a .fla and it should work fine).

Attached File  Dragon_Kwest.txt (195.5K)
Number of downloads: 125

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#13 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 10 January 2009 - 07:52 PM

Could you just attach it as a .fla for me?
Was This Post Helpful? 0
  • +
  • -

#14 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1138
  • View blog
  • Posts: 7,108
  • Joined: 07-September 06

Re: Input text

Posted 10 January 2009 - 11:02 PM

Here's a link:
http://www.reigningg...ragon_Kwest.fla
Was This Post Helpful? 0
  • +
  • -

#15 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Input text

Posted 11 January 2009 - 06:25 AM

OK, I downloaded it, but it keeps saying unexpected file format. Then it closes. Try attaching a a zip.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3