Choose fontsize:
Welcome, Guest. Please login or register.
Did you miss your activation email?

 

Pages: [1]   Go Down
  Print  
Author Topic: Input and Dynamic Text Boxes  (Read 23300 times)
0 Members and 1 Guest are viewing this topic.
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« on: December 06, 2005, 03:37:05 PM »
[h1]Input and Dynamic Text Boxes[/h1]
Up until now, all of my tutorials were about Movieclips, and attaching actions to them.  In this one, however, I'll tell you about Input and Dynamic Textboxes...okay, and a few actions on Movieclips...
Oh, and if you don't know how to make a button, take ZT's tutorial REALLY quick, I'll use them a little, here's link:
Linkey to ZT's Simple Button Tutorial

Uses
People use these two different text boxes all the time, and mainly in games, here's a list of what I mostly use them for:
* - Dynamic Textbox
* - Input Textbox
  • *Displaying variables such as Score, Health, and Loaded percentage on a Pre-loader
  • *Letting the user choose a name
  • *Letting the user interact with certain actions
  • *Making complex strings that can be modified
  • *Checking user input, and 'filtering' out certain words

Before I continue, let me explain what most of these options mean, click on the explanation to see an image of it:

Also, I've forgotten this, but thank's to Capt. Obvious, I'll add it:
How to format strings in flash
Here is the simple way, to add a strait string:
[string variable] = "[string]"

Say, you want a variable in it, here' how it works:
[string variable] = "[string]"+[other variable path]+"[More String]"

That's about it! You can make some pretty complex strings like this, but mind you, it's not like PHP, well, just replace the '.'s in PHP with '+' (if you don't know PHP, disreguard that!)


Dynamic Text
To insert a dynamic text box into your movie, click on the text button on the toolbar:

You'll get something like this:

But, that's when I first clicked it, some values may be different, but the properties thing reads the same, regardless. Now, make it look like this:

You may notice that you have to click on the stage to un-lock most of the options (Like variable, instance name, and the size information).

For input text, simply change the dropdown and select it!

Example
I'll use the Input and Dynamic text to show you how to let the user input their name, or whatever they want to, and display what they inputted in a dynamic text box.
Start up a new flash document.  On the first frame, give the frame itself this action:
Code:
stop();
Now, insert an input textbox, and place it anywhere you like.  Select the textbox, and press 'Properties', set it up like this:

Now, add a button, draw whatever you like, I'm making a basic submit button.
Now, add a static text above it, style it as you please, and put 'Please enter your name, then press the button to continue!'
Here's what mine looks like so far:

Next up, add these actions to the submit button:
Code:
on (release) {
_root.nextFrame();
}
That's just to simply continue to the next frame, but whoops! There is no other frame! Insert a blank key frame on frame 2.
On frame 2, we need something to display what the user puts in on frame 1. So, add a dynamic text box, and set it up like this in properties:

There's just one problem; what's it going to display? I put in to display the variable 'output', but we haven't set what that is yet! So, on frame 2 itself, add this:
Code:
output = "Welcome "+_root.user_name+"!";
What that does, is set the variable 'output' to the string "Welcome ", then the variable, _root.user_name, which was if you remember, the variable for the input text!
Here's what I got when I tested it (CTRL + ENTER):
<a href="http://www.graphicaddicts.net/ssj/Text%20Boxes.swf" target="_blank">http://www.graphicaddicts.net/ssj/Text%20Boxes.swf</a>

If you like this tutorial, please Click Here to register.

Click the link below to download the Flash file for this tutorial.
Input and Dynamic Text Boxes FLA
« Last Edit: February 10, 2006, 07:21:44 PM by ssjskipp » Logged
Tutorial Writer
*

Karma: 9
Gender: Male
Posts: 1,254


I'm mighty tighty whitey and I'm smugglin' plums.


View Profile WWW
« Reply #1 on: December 16, 2005, 01:29:50 PM »
Awesome Smiley
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #2 on: December 16, 2005, 06:49:33 PM »
 8)I get a cookie >=]
Logged
Member
*

Karma: 3
Gender: Male
Posts: 151


View Profile WWW
« Reply #3 on: December 20, 2005, 03:29:38 PM »
Ok, I tried doing this with a "Mad Lib" type thing, but I'm getting a syntax error. I'll send you the .fla ssjskipp if you get on AIM sometime.
Logged
Tutorial Writer
*

Karma: 4
Gender: Male
Posts: 1,114



View Profile WWW
« Reply #4 on: December 20, 2005, 06:07:55 PM »
I'm online now =o!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:      

Pixel-Designz [ In: 1183 // Out: 2917 ] BioRUST [ In: 2951 // Out: 2428 ] MickM [ In: 2404 // Out: 2118 ] SMF Topsites [ In: 0 // Out: 2021 ] Graphic Addicts Topsites [ In: 2435 // Out: 3389 ] Vero Graphics [ In: 509 // Out: 1591 ] Dr. Photoshop [ In: 1301 // Out: 1634 ] Glitch Seekers [ In: 526 // Out: 1461 ]
Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Phobos design by Bloc | XHTML | CSS


Google visited last this page Today at 07:05:40 AM