ActionScript 3.0 :: Input Box Wont Allow Numbers?
Jan 25, 2012When I try typing in numbers into the input text box, nothing happens.Can anyone explain why and/or how to fix?
View 8 RepliesWhen I try typing in numbers into the input text box, nothing happens.Can anyone explain why and/or how to fix?
View 8 RepliesI using Flash CS5 for the first time, and I'm hitting a snag. I have an input box on Scene 1 for age (variable called old). On scene 3, I have a dynamic test box (variable called display), where I want to display the age (old) + 10.
My Code looks like this:
PHP Code:
var Real_age = Number(old) + 10;
display = Real_age;
It's returning NaN.
A trace of the output of Real_age gives:
PHP Code:
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT">
<FONT FACE="Times New Roman" SIZE="12" COLOR="#009900" LETTERSPACING="0" KERNING="0">2</FONT></P></TEXTFORMAT>
<p align="left"></p>
<p align="left"></p>
NaN
<p align="left"></p>
<p align="left"></p>
The code works OK in Flash 8, but I figure I must have some some setting that is spitting out the unwanted HTML.
i want to restrict the input to numbers only, but do have a problem for an empty entry:
now accessing like this:
var newValue:Number = event.itemRenderer.data[event.dataField]
newValue is now for an empty entry not null, but 0...
I have an input text box and I want the user to be able to enter a number in the text box and hit a button and it will jump to that frame of a movie clip. For some reason I can't get the input text to read the input as a number. I have tried using parseInt or Number, but it gives me this output instead. "<TEXTFORMAT LEADING="2"><P ALIGN="CENTER"><FONT FACE="Myriad Pro Light SemiCond" SIZE="13" COLOR="#000000" LETTERSPACING="0" KERNING="0">2</FONT></P></TEXTFORMAT>" when I just want it to say "2".
Here is the code I have linked to the button:
Code:
btn_newPage.onRelease = function (){
pageNum=parseInt(pageString);
[code]...
On the trace of pageString I get the text i put in above and then pageNum comes back as NaN.btn_newPage is the button they would click after they have input a page number in the input text box. pageString is the name of my input text box variable and I was trying to use pageNum to change it to a number. And doc_content is the movie clip I am trying to control.
How can i Take only numbers into the text input field...
View 1 Repliesis there a way to only allow a user to enter numbers in a text feild. setting embed text to numbers only worked for a while, but have to embed all now.
View 1 Repliesthere fellow actionscripters, I am currently studying design and I have a code that was constructed on class:
Code:
var mc:MovieClip = this.createEmptyMovieClip("mc", this.getNextHighestDepth() );
var image:String = "hxxp://static.vgcats.com/gallery/walk_wallpaper_800.jpg";
var mcl:MovieClipLoader = new MovieClipLoader();
[Code]......
I have to make it, so that a user can input a value (0-255) so they can edit the GBR on the spot.
Like, putting those numbers in an input box and have the picture change according to those numbers.
I'm stumped on this problem and can't seem to figure it out. Any suggestions would be welcomed. Basically I'm building a large calculator that adds over 100 input boxes. I've got it working except for the fact that if a user misses inputing a number into one of the input boxes it does not work anymore. I've tired lots of things to no avail. I just want to add the input boxes and skip those where the user did not enter any information (does not apply to them)
Here is my code.
on (press){
ReceptionTotal = Number(LocationFee) + Number(Caterer) + Number(ToastingGlasses) + Number(SecurityFee) + Number(BarPackage) + Number(WeddingCake) + Number(FoodHors) + Number(Baker) + Number(BartentingFee) + Number(CakeKnife) + Number(Servers) + Number(Flatware) + Number(Dinnerwear) + Number(Flatware) + Number(TableLinens) + Number(ChairsCovers) + Number(Glasswear) + Number(Tent) + Number(Napkins) + Number(Childcare) + Number(DanceFloor) + Number(ServingStaff) + Number(Lanterns) + Number(Heaters) + Number(Restrooms);
}
each input box has a variable name assigned to it as indicated above. I've tired setting the variables to 0, tried if statements don't know how to skip one of the above variables when no number is entered.
I am using actionscript 2.0, and I actually have a simple question: the TextInput.text property returns the text string in quotes. However, I am calculating something and don't want it in quotes. How do I get rid of the quotes so I can calculate stuff?
View 2 RepliesI've written a function that restricts user input to just numbers (0-9,.) and stores the input in the associative array, userInput[]. It works but seems inefficient looping through the entire input text string to scrub out invalid characters. Anyone have suggestions for a more efficient approach? Note that a working solution must correctly process mouse or cursor key movements/edits within the input box.
Also, you can see I'm using the KeyboardEvent.KEY_UP event to trigger the processing. The docs seem to indicate TextEvent.TEXT_INPUT is really the proper event for this purpose. I started with TextEvent.TEXT_INPUT but found the event is triggered before the last key pressed is actually added to the instance. The result is that the function was always one characterbehind. Is there an easy way to get the current text in the input box, including the last key pressed, when processing TextEvent.TEXT_INPUT?
I would like to restrict user input to numbers only between letters. for example: the user is allowed to input "a2b", but "2ab" or "ab2" isn't allowed.
View 4 RepliesI have two input boxes that I can type numbers into.I'd like a third input box to display the total of the first two.I've set up a key pressed listener on the stage to run a function that adds them together when a key is pressed.Problem is, it just places the strings together - it ddoesn't add them.So how do I tell Flash that box1.text and box2.text are numbers?box3.text = box1.text + box2.text ain't doing it.
View 5 RepliesI would like the client to be able and type only numbers, and the minus (-) sign into an input textfield. The reason I need them able to type a minus (-) sign is in the case they need the number to be negative. However,
[Code]...
I'm making a sudoko solver, and i have 81 input fields. They're named from i11 to i99. The first number is the column number "x", the second number is the row number "y". I want to transfer those numbers out of the input fields, and into an array.
[Code]...
is something wrong with the way I am naming the grid array? After tracing just about everything, that must be the problem.
I have some input text fields (by the text tool, not the component) in my form that I was wondering if they could be auto-formatted. I was looking specifically for dates & numbers. For example when the user inputs 082606 and then tabs away it would immediately update to 08/26/06, or when the user inputs 50000 it would immediately update to 50,000.
View 4 RepliesI'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?
so i updated a site and now the input text part on my form does not input numbers or signs which i need the @ to work for the form to work and i tried to fix it on cs4 and it will not work because its not the same format since i updated it from cs4 to cs5 and now i cant go back. How do i get the numbers and signs to work now?
View 3 RepliesI have two questions the first being how could i restrict a text input area to allow it only to recieve entries 1 - 49 I have tried
I1.restrict = "0-9";I1.maxChars = 2;
The second being how could i restrict the inputfields to not allow duplicate numbers?
There are 6 of them as follows:
[Code]...
We're making a simple input text comparisons vs. some constant floating point numbers (e.g. 4.35). Using Actionscript 2 to Flash 9 export. Getting totally contradictory traces on two different computers compiling identical code...Here's some simple code we're using to figure out what's going on.
Code:
trace(typeof(Number(435/100)))
trace(typeof(Number(435/100)==4.35))
trace((Number(435/100)==4.35))
[code]....
Also, what behavior do any PC users have? I'm expecting the latter since they're generally intel chipsets too?Note: once i compile the code on my PPC mac, intel macs that run the SWF (but don't recompile the FLA) do return the correct booleans that match the PPC output.
I am trying to automate the input process so that when a user inputs 3 numbers into the first field, it automatically jumps to the next one. I have the code to do it and it seems as though it should work but, for some reason, when I move focus from one field to the next the data in the previous field is re-arranged so that the last character input becomes the first (610 becomes 061 - for example).Here is my code:
Code:
phone1.width = 30;
phone1.move(10,10);
[code].....
how to do this and not found much, so here goes:
I want to generate a variable number of random numbers less than 16 with no duplicate numbers
Ive posted the fla, and what i'm doing is generating a random number and putting it into an array then using a for loop to cycle through the array for each new random number to check if its already there. if it is, then i want to regenerate that number.
if you test the fla you'll see that all i get in my array is some lovely zero's and i sort of know why this is, but don't know how to stop it.
I am trying to convert a string having numbers to an integer.
//15 9's are there
var str:String="999999999999999"
var res:Number = new Number(str);
But it is not able to convert correctly as the the var res now has the value 100000000000000000. I know that the number has 52 bits of memory, then why is it not able to do the conversion?
Generate four random numbers with the total of the four numbers equal to100?[code]...
View 8 Repliescreate a function that picks out X amount of numbers from a set of numbers? So if X=3, then i need this function to pick out 3 different numbers from say a set of numbers (1, 2, 3, 4, 5, 6, 7, 8) and then stored it into X number of variables.
In saying that, X will only =2, and =5. So in the first instance, i'll need 2 random numbers from the set above that are not the same numbers, and second instance 5 random numbers from the set above (also no repeats of numbers). Then i need to be able to store those 2 or 5 different random numbers from the set into variables to call them with other functions.
what is the syntax to pick how can i pick 6 random numbers from 49 numbers
View 9 RepliesI am generating random numbers between two numbers by the code bellow:
ActionScript Code:
public function randomRange(max:Number, min:Number = 0):Number
{
return Math.round(Math.random() * (1+max - min) + min);
}
trace(randomRange(3,-31));
But I need a code which will return some times '3' and some times '-31'. Not the number between them.
I have been using Actionscript 3.0 in Adobe Flash Builder for a few weeks,and I really like it! Bare with me because I'm not really good at it, yet. Anyway, I was wondering how would I go by adding up odd numbers from an array of numbers? I know how to make all of the numbers add up, but adding only the odd numbers I'm not so sure how to do it.
View 5 RepliesEverything seems to be a string right now & that kinda ruins the whole xml as an internal data structure thing, I don't need a big tree of string I need typed data :-/ Are there any changes I can make to either my XML files or my AS3 code that will force it to cast ints as ints and Numbers as Numbers? Or maybe some kind of type schema I can impose? Not really worked with XML til recently so chances are I'm just ignorant of the canonical way to deal with this...
View 4 RepliesI am trying to check input answer against random display from array. but sometime it trace not correct when it is correct this is the code i use
[CODE]....
If i have two or more input boxes to create a crossword puzzle, how can i make the cursor automatically jump to the second input box after the first input box is filled with a character?
View 3 Replies