all groups > flash actionscript > january 2004 >
You're in the

flash actionscript

group:

limit input to numbers?


limit input to numbers? daniel plochinger
1/27/2004 11:54:14 PM
flash actionscript:
is there any way to limit a input field to numbers so it wont take anything else? (even better: take nothing else except delete, but if the fields left or not filled in about 1-2 sek. it jumos to the last entry..)

check how i did it:
http://www.monstermouse.net/gf2/gf_flash.htm
(go to the cogwheels, ad a shirt or two, and then go onto the guy in the main nav. there you can change the amount, but sometimes the input "cursor" blinks in more fields at the same time! the fields are instaces of a "item" object in the libary added 1 for each shirt you add to your cart.)

the code is following:

amount is the var of the inputfield
globalcart[id][9] is the last inputed amount

this.onEnterFrame = function(){{
if(!amount){
amount=_global.cart[id][9]
}
_global.cart[id][9]=amount
}}


thanks, danny.

Re: limit input to numbers only? Brajeshwar
1/28/2004 12:11:33 AM

//restrict input fields to just numbers
myText_txt.restrict = "0-9";

Regards
Brajeshwar
http://brajeshwar.com
http://oinam.com
Team Macromedia Volunteer for Flash
Re: limit input to numbers only? daniel plochinger
1/28/2004 12:26:59 AM
thanks alot!
one more question: is it possible to outclude the delete button in a simple way? i don't want the inputz to be not defined..
thanks -d.

AddThis Social Bookmark Button