Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Detecting Letters And Numbers In Input Field



Is there a way to detect that a variable contains letters rather than Numbers. I am creating a spreadsheet in Flash which is complete except when cells are added etc and one of the cells to be added contains a letter the result is NaN - I need a way to detect letters so that cell can be ignored!!
Cheers
Ol



FlashKit > Flash Help > Flash ActionScript
Posted on: 03-17-2003, 03:52 AM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Numbers V Letters In Input Box
I have a form in flash that a person would enter a quantity of a certain product. If a person puts letters into the input box instead of numbers, I want a box to pop up indicating that they need to put numbers in the box.

Question: can you do an if statement for a variable to recognise letters instead of numbers?

cheers.

Text Field Cycling Through Random Letters And Numbers
I'm trying to get a text field rotate through random letters and numbers, for about 5 cycles each character, then I would like the text filed to resolve into "my chosen text" - I can do it with a different text field for each letter, BUT I want to do this with only one text field for each phrase.

Check Whether Characters In Input Textfield Are Numbers Or Letters?
I just can't get this right.
I have two textfields:inputTxt (INPUT)
statusTxt (DYNAMIC)
I have a button, which when pressed should check whether the characters entered into the input field are numbers or letters.
I have tried:

Code:
private function onMouseUp(evt:MouseEvent):void {
if (isNaN(inputTxt.text)) {
statusTxt.text = 'You have not entered a number';
}else {
statusTxt.text = 'You have entered a number';
}
}
I realise now that isNAN() only checks a variable value rather than a string value.
How does one do this?

Check Whether Characters In Input Textfield Are Numbers Or Letters?
I just can't get this right.
I have two textfields:

1. inputTxt (INPUT)
2. statusTxt (DYNAMIC)

I have a button, which when pressed should check whether the characters entered into the input field are numbers or letters.
I have tried:

private function onMouseUp(evt:MouseEvent):void {
if (isNaN(inputTxt.text)) {
statusTxt.text = 'You have not entered a number';
}else {
statusTxt.text = 'You have entered a number';
}
}

I realise now that isNAN() only checks a variable value rather than a string value.
How does one do this?

Check Letters In Flash Input Field...
Is there a way i can check what letters are within a string in a textfield, for example i have a textfield, the user is restricted to the letters "BIU" (bold,italic,underlined) - but i want to disable the ability for the user to be able to input "BUU" for example - basically i don't want there to be any duplicate letters within the textfield.... ?

Input Field - Force Capital Letters
is there a way to force capital letters to an input field?
im using a pixel font and looks crappy in lowercase..

Input Text Field: Embed Uppercase Letters
Hi all,
I use input text fields with character options chosen to embed only uppercase letters. I have used this type of field many times before, but for some reason in my current project the uppercase outlines are not embedding for all letters. For example, when I type "who" in the field it looks like "Who" instead of "WHO" or when I type "hat" in the field it looks like "hAt" instead of "HAT".

I have tried copying fields from other movies that work correctly, recreating new fields, and changing the instance names. I don't use any type of special programming other than the settings in the properties panel and have never had this problem. Any suggestions regarding what could possibly be set differently to cause this?

Only In Numbers In Input Text Field
Is it possible to have a input text field to accept only numbers?

thanx

How Do You Restirct Input Field To Numbers Only?
i have a text box and i want to make sure that the viewer can not enter anything but numbers in there (decimals are ok); so i guess i need to check whether input is number or not - how is this done?

thanks,
-tm

How Do I Make An Input Field Take Numbers Only?
Can someone tell me how I can make a text input field accept numbers only?

Thanks.


OM

Allow Numbers Only In Input Text Field
Hi

I have text fields into which I need numbers (2 numbers each max) entered by a user.

I have looked along the lines of a regular expression but - have gone a bit wrong since Flash is taking the string literally and is looking for the whole regular expression as a string. This was the wrong code -

var pattern:String=("\d{1,2}");
for (i=0;i<=6;i++)
{
if (!(numbers[i]==pattern)){
dynamictextboxwrong="Numbers only in these boxes"
return}
}

Any suggestions would be welcome. By the way, does actionscript 2 do regular expressions with Flash 8? If not, how can I go about validating these text boxes to accept only numbers.

Thanks

[MX] Detecting 5 Digits In Input Field
Hi all,

I've been noticing users are submitting my form without entering information.

With my limited action scripting knowledge I've been unable to script in a way to check input fields before activating the submit button.

I searched all over google for tutorials and couldn’t find any that has answers to my problems.



If someone with a lot of time wants to help for free, thats always welcome

Edit by admin: no contact info permitted on the forum, thank you. If you want to hire someone, we will move to the freelance forum

Detecting What The User Has Typed In An Input Field
I want to play an animation when a user types in a certain letter in my input field. I made a frame action that says if text equals "A" then play the movie clip. But it doesn't work. I tested the movie and listed the variables and it says that the text field does equal
"A" so why doesn't the movie clip play?

I added a button just to see if it would work, and when I typed in "A" and pressed the button, the movie clip did play, but I don't want to use a button. I want the clip to automatically play depending on what is typed in the field.

Does anyone know how I can fix my prob?

Thanks!!

Detecting Html Tags In Input Field
Can we detect html tags in the input text field?

Convert The Letters To Lowercase ONLY If They Are Actually Letters, Not Numbers?
I have a glitch with this line of code:

one_array.toLowerCase();

in a dynamic input textbox. If the string includes a "!" it becomes a "1" .

Is there a way to only convert the letters to lowercase if they are actually letters - not numbers or punctuation? Do I have to write a line of code for each character, or is there an easier way to do it?

Input Field: Restrict To Numbers INCLUDING Space?
Hi all, I'm trying to make an input box restricted to characters 0-9 including the space bar.

I can do;

mytext.restrict = "0-9";

but how do I account for space? any ideas or solutions would be greatly appreciated.

Input Field: Restrict To Numbers INCLUDING Space?
Hi all, I'm trying to make an input box restricted to characters 0-9 including the space bar.

I can do;

mytext.restrict = "0-9";

but how do I account for space? any ideas or solutions would be greatly appreciated.

Detecting A Blank Entry In An Input Text Field
Can someone put me straight on this one. I have 2 scenes in my shopping basket / flash / asp project so far.

The first scene is a form that gets the user to input details then press the submit button to be taken to the next scene. I dont wont the user to be able to get to the next scene without filling in all of the input boxes. (I am using the follwing code with 8 variables being sent to an Access database via an asp page.) Frame 2 of this scene is a replica of frame 1, but with an additional textfield saying "you must fill in all of the text fields to proceed."

//code starts here

on (release) {
if (fName=="") {
gotoAndStop (2);
} else if (lname == "") {
gotoAndStop (2);
} else if (address1 == "") {
gotoAndStop (2);
} else if (townCity == "") {
gotoAndStop (2);
} else if (countyState == "") {
gotoAndStop (2);
} else if (postcodeZip == "") {
gotoAndStop (2);
} else if (email == "") {
gotoAndStop (2);
} else {
loadVariables ("http://lon001/flash/database_research/database_practice/basket_shopper_details.asp", "", "POST");
gotoAndStop ("shopping", 1);
fName = "";
lName = "";
address1 = "";
address2 = "";
townCity = "";
countyState = "";
postcodeZip = "";
email = "";
}
}
//code ends here

i am trying to detect a blank entry in any of the fields. However on press of my submit button i simply move to the shopping scene and ignore the above instruction.

Can anyone shed somelight on my code - i am sure my "if...else..if" statements are correct.

Detecting A KeyUp While The Focus Is On An Input Text Field
^^pretty much what that said^^

When an input text-box is selected "onKeyUp" is never called..

I'm trying to create a live-search thing where it searches while you type, a bit like the spotlight feature on Mac OS X.

Is there a way to get around that like use a listener or something.

I have thought of one way: get javascript to detect a key release then tell flash about it but I'm trying to contain flash related stuff in the flash file...

can anyone help?
-Jacob

Input Numbers From Cellphone Into Dynamic Text Field By Clicking On Buttons
hey there,

I am constructing a form mailer that has a cellphone skin. To add some functionality I want to let the user click on the numbers of the phone and have the numbers appear into a seperate dynamic text field. (not to be sent via the form) How do I code it where they can click on the numeric button and the number will be added to the field while letting the numbers that were already clicked will remain in the field and not be erased.

thanks
-J

What Are The Key Numbers For Letters.
could some1 show me a list of key numbers for the letters

Help...letters To Numbers
hey guys,
i need to make a program in flash in which you type in your name and it translates your name into numbers:
A|J|S = 1
B|K|T = 2
C|L|U = 3
D|M|V = 4
E|N|W = 5
F|O|Y = 6
G|P|X = 7
H|Q|Z = 8
I|R = 9
and after translating i need to split the numbers into 3 sections...first i need to sum up all the constanants then i need to sum up the vowels and then sum up all of the letters...but i need to make it so that if the number goes higher then 78 it needs to go back down to 1; ex:79=1 80=2 81=3 etc etc

so summing up: you type in your name then after you click a button to submit your name it goes to a new keyframe that shows you all 3 summed up numbers...

is their any way to do this?
thx in advance

Detecting Letters
I want to be able to detect when a certain key is pressed. Not the preset ones like spacebar, enter, delete, left, right, etc... I want to make it so that when the letter "a" is pressed, then such and such happens, and if the letter "m" is pressed, another thing happens.

Treating Letters Like Numbers
is there an easy way to add 1 to a letter sequence?

i.e A + 1 = B B + 3 = E etc

Comparing Numbers And Letters - But How?
Hi there!

I'm trying to write a program which allows the user to translate a series of numbers into letters.
The numbers are autogenerated, and it's then left to the user to translate those numbers into letters.

Basically, I need to be able to verify if the user has written the correct string of letters matching the autogenerated string of numbers - but how?

This is what I've got so far:
http://playground-gfx.com/Untitled-2.fla

Any ideas?

Validate: Letters And Numbers Only?
Hey guys ,

Could someone please help me out here. I'm trying to create a function in FMX that validates a field for numbers and letters only, i.e. no special characters. I know how to check for number strings and so on but trying to check for letters in a string?

I used to have a PHP function that did this for my password field (below) and I would like to do something similar in Flash


PHP Code:



function valid_password($pwd){
   // check valid password
   if(!eregi("^[a-z0-9]{1,15}$",$pwd))
   {
     return false;
   }
   else
   {
      return true;
   }
   





Thanks in advance!

Random Numbers And Letters
Hello, first time poster here so bear with me!
I am making a countdown style game in flash 5 for my primary school class to play but there are two problems I am having with the scripting.
I can generate random numbers between 1 and 10 when you click a button but that's about it!
I want to be able to click a button and a random number is returned from the choice of '25, 50, 75 or 100'
HOW DO YOU DO THIS?
I also want to be able to click a button and a random vowel is returned!

And if you can do that.......can I click a button and a random consonant is returned?!

Sorry if this is a bit basic but it's driving me mad!!
Look forward to hearing how to do it!
Chris

Validate Letters And Numbers Only?
Hey guys ,

Could someone please help me out here. I'm trying to create a function in FMX that validates a field for numbers and letters only, i.e. no special characters. I know how to check for number strings and so on but trying to check for letters in a string?

I used to have a PHP function that did this for my password field (below) and I would like to do something similar in Flash


PHP Code:



function valid_password($pwd){
   // check valid password
   if(!eregi("^[a-z0-9]{1,15}$",$pwd))
   {
     return false;
   }
   else
   {
      return true;
   }
   





Thanks in advance!

How To Cycle Through Letters And Numbers With Buttons
The scenario is this: I have 5 screens. On screens 1 through 4, there are 4 buttons: Buttons 1 and 2 let you choose the character position (max of 15), moving forward and back respectively. Buttons 3 and 4 allow you to cycle through the alphabet and other keyboard characters (including spaces) moving up and down repectively to enter a name. If the last character is reached, it begins again. The fifth screen will show the 4 results, whatever has been entered on screens 1 through four.

My actionscript is no where near the level to figure out how to do this on my own. By reading the boards, I can usually get through what I need to do. Does anyone have a suggestion on this?

[F8] Possible To Advance Letters Similarly To Numbers?
This is just a quick question, is it possible to advance letters similarly to numbers? Like if you have a variable holding a number you just need to type varName++ can you do the same thing with letters?

I ask because I'm thinking about making a flash chess game and am thinking about how to go about it. I'm thinking the best way would name all the tiles according to their position (a1-a8, b1-b8, etc) then when a piece is clicked on it would check each tile along that piece's range and if it is open it would highlight that tile.

Would it be practical to code it to pull the substring of whatever variable I am using to check the tiles and advance it accordingly. If that didn't make sence, something like this:

code:
tileToCheck = a2;
//here would be some code to check that tile
tileToCheck = tileToCheck.substring(1,1)++ + tileTocheck.substring(2,1);


I probably dont have the syntax right, but regardless, would that be the best way? Should I store each part of the name separately? Or should I just store the letters as their numeric counterpart (a=1, b=1, etc).

Thanks for any help/advice

Randomly Generate Letters And Numbers?
Anyone know of a quick way to randomly degenerate a series of 8 letters and numbers?

Converting Words And Letters Into Numbers
as a newby on the forum i would like to ask you if you could help me out.

I need to convert a many paged document into numbers.

logicly a=1, b=2, ..z=26 & 1=1, 2=2, etc..
the numbers of the letters need to be seperated by comma's

and the spaces between words must be replaced by dashes


so for example:
"i am crazy for doing this" should look like this:

"9-1,13-3,18,1,26,25-6,15,18-4,15,9,14,7-20,8,9,19"

does anyone know of a script that will take up to 500 words per conversion, or does anyone know a application that will be able to do this? unlimited amount of words would even be better.

Thanx in advance,
Raoul

[flash 8] Detecting Drawn Letters
I've been giving thought to this for some time now, but I haven't been able to this point, to come up with something worth doing...

So, to lay the problem on you guys. Naked scene, nothing on it, and you have this simple drawing thing -> while you press the mouse button and keep it pressed, you draw stuff on the scene, when you release it, no more drawing.

What I am interested in is -> Let's say you draw a letter. A "R" for example. How could I make flash detect what letter it's been drawn? My ideas spin around having small, invisible movieclips all over the stage, and then somehow making use of those who've been pressed...
But from there on out, it's a standstill. So, any ideas, because I would sure appreciate any?

Cheers

Limit Text Boxes To Oly Letters / Numbers...
Can you limit text boxes to only letters or numbers?

I have two text boxes and I want the user to be able to enter ONLY letters in one, and ONLY numbers in the other one...

Can ya do dis?

Thanks!

Joe

Why Won't Actionscript Join Letters And Numbers Into A String?
Here are some snippets from my air traffic control simulation. These lines are supposed to combine a letter with a number value (eg. H090)

strip.VairspeedStrip = assignedIAS + "K";
//produces the result "300" missing the K

strip.VheadingStrip = "H" + headingAssigned;
//produces the result "090" missing the H

strip.VairspeedStrip = "M." + assignedMACH;
//produces the result "M.78" correctly

Why does it only work on the last of the three? How can I force actionscript to concatenate?

Ken

Clientid Type Differs Between Client (letters) And Server (numbers)
Hi all,

I am trying to make some useful reporting using the access log files and clientid.
I assumed c-client-id and Stream.onStatus infoObject clientid content were the same thing, but when testing my client machine returns client like BIAYYjdH and the server logs clientid as numbers only.

I have spent a few hours looking on the net to see wether there was any discussion about clientid type or format, but still no luck.

Am I going the wrong direction?


Thanks a lot,


Best
d

How To Make Randomized Numbers And Letters Before It Reveals The Real Text.
Alot of the space aged sites have this random numbers/letters before the text is revealed.

eg.
The dog jump the puddle.

This will pop up as this fast numbers and letters changing then one by one each letter stop to show the sentence, "The dog jump the puddle".

I currently do this with timeline, but I am not really getting random numbers/letters, exacept the numbers/letters I have set in my movie. Its also time consuming, but I heard this can be done with script.

Detecting Numbers?
Hi,

I want to create this game, and I need a little help with the actionscript:
I have many walls, every wall has a name: wall1, wall2, wall3, etc.

Now when you bump into a wall, it automaticaly detects when there is a wall, and whether you can go through it. It is working, but I need to rewrite the etire hitTest script for each and every wall.
Is there an easy way to like combine the word "wall" with the numbers, 1, 2, 3 etc. inside some variable? Any help would be great!

Thx,
Death

Detecting Even And Odd Numbers
Hi, I'm drawing a series of rectangles using AS3, and need every alternate one to be lighter... I'm using a switch statement currently, with a variable counting the number of rectangles and case 1, case 2, case 3, etc.

Is there a formula or some way of telling whether there is an even or odd number of rectangles so my switch statement can just be case even:, case odd: ? The way I have it is fine for 10 or so rectangles but I'd rather make it more expandable.

Would appreciate any suggestions





























Edited: 11/10/2008 at 02:29:40 AM by fatbuoy1

Detecting Odd Numbers?
Is there a script to detect if var a is odd?

I'm trying to do this:


ActionScript Code:
var a:Number = 3;if(a is odd) {trace("a is odd");else {trace("a is even");}
And yes var a will always be a whole number, never a decimal.

Random Letters In A Text Field
I am trying to generate random numbers and letters, ALL CAPS, in a one letter text field. After the text field has displayed 20 letters/numbers I then want it to stop on the letter "S" - I have tried many different ways and cannot get it to function correctly -

can you help...

Parsing Input Into An Array Of Letters
Hi everyone,

I was hoping that someone could help me with a peculiar problem, that I could not find the answer to all over the web with some advanced Google Searching. Here it is: I would like to parse some User Input Text into individual letters (probably using an array so the letters can be used and changed easily).

The goal is to create an encryption flash script, which will take in a user input sentence, and spit out a jumble of "random" letters with a 4-Digit code. The end-user then takes the jumble, puts it in to the box, punches in the 4-Digit Code, and decrypts the message. I understand there may be ActionCrypt and stuff, but I'd enjoy attempting this myself. I have all the other data I need (translating letters in an array into numbers, jumbling the numbers, turning those numbers into letters, and then allowing the end-user to enter those and reverse-engineer the original sentence).

All in all, I only need the code to parse input text (in this case, and for the easiest idea, lets say 10 letter maximum) into an array of individual letters per sector.

To make this easy for me to understand, I'll give you some variables to work with, so if you post code, I understand what you mean with the variables:

input_txt = User Input Box
encrypt_btn = The button one will press, and thus make the (hopefully new) sentence be parsed into an array

So pretty much, I'm assuming the code will begin with the encrypt buttons AS:

"this.on(Release) = function()"

That's the way I imagine it at least... If any of you have an extremely advanced way, that's fine by me. Use all the variables you want, array names.... everything!

Thanks to Everyone

Letters Appearing Randomly In A Text Field?
does anyone have a clue to how I might do this:
I want a text field where the letters of my text appear randomly over time. no fancy swurlings or whatever, just letters turning from for instance backgroundcolor to white.
I'm thinking action-scripting, but I don't know how.
please let me know if anyone knows
kn

Stopping Letters From Displaying In Text Field
I have two input text fields where the user inputs there height and weight to get their Body Mass Index value. However it is possible to input letters in these fields.

I was wondering if there is a way of not allowing letter keys to display within these textfields if the user pressses them or if the user does input letters I can tell flash to bring up an error messege.

Any information much apprciated

Checking If EMAIL Field Contains Specific Letters
Howdy ...

I am building a small email field, but i am stuck at the verifying routine to check if the Email contains

@, .de two letter domains or .com three letter domains ...

any hints???

thanx in advance

ChromeD

[MX04] Stop Letters In Input Text Box
Hi, I need a way to keep users of a flash movie from entering letters in an input text box, so that they can only enter numbers. Is there a way to do that? Or a way for a piece of code to check for characters other than numbers in the input text box? Thanks.

EmbedFonts: Input Textboxes Draw Letters Slow
I have a number of Dynamic and Input textboxes within my movie. All of which have embedFonts. They all contain the same font atleast. Now my problem is that when testing the form with the input boxes, flash cannot draw the text fast enough. Considerable delay when entering data! In an effort to resolve this issue, I have tried to reset the textboxes to use device fonts; however when I try this the textbox nor the text appears when testing. Racking my brain trying to figure this one out! PLEASE HELP!

Detecting Input For Input Boxes
Hi. I a flash frame with two input boxes for userid and password. What I want to do is detect when text has been entered in both boxes so that I can make the login button visible afterwards. How can I do this? Is it possible?

Thanx.

VB Placing Letters In A Dynamic Text Field Trigger An Event?
Hi,

I'm a newbie creating a simple (so I thought) program using Visual Basics and Flash CS3.

I am trying to get Flash to load and play a movie clip when Visual Basics places a letter "c" in a Dynamic Text Field in Flash.

I got Flash to display the letter "c" Visual Basics placed in the dynamic text feld, but how do I get Flash to see that letter as a variable? Also, once it sees it as a variable how do I get it to trigger an event? I don't want a mouse click or keyboard click, I just want Flash to load the appropriate movie clip and play it once Flash receives the letter. Is this possible?

If anybody can help, I would appreciate it. Thank you.

Copyright © 2005-08 www.BigResource.com, All rights reserved