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








Restrict Input


I need it so that only numbers can be typed into the input text field

I've been trying this for a while now, I have already tried textfield.restrict(0-9); and textfield.restrict = "0-9"; and other such codes, but with no positive results

I do already have a button that checks if the value in the text field is between certain values and if there not it returns an error statement, I was wandering if i could put an if statement there to check if there are only numbers in the field

Help would be much appreciated




FlashKit > Flash Help > Flash General Help
Posted on: 10-21-2006, 12:51 AM


View Complete Forum Thread with Replies

Sponsored Links:

Restrict An Input Box
Hey guys,

I was just wondering how can I restrict an input box to only accept the numbers 1,2,3,4 or 5 but nothing else.

any help would be appreciated!

View Replies !    View Related
INPUT TEXT - How To Restrict Number Of Lines Of Text A User Can Input Into Textbox
In a flash form I've created I have a input textbox. I don't want the user to be able to input more than 7 lines of text. Is this possible to do? I know that I can set a value for 'max char', but this is not useful for me -- it's essential that the user cannot input more than 7 lines of text.

How can I limit the number of lines a user can input into a textbox?


Thanks!
Glenn

View Replies !    View Related
Restrict Input To Numbers Between 0 And 10
I can't figure out how to restrict an input field to only allow numbers between 0 and 10 - not 11 or above.
I have set the Maximum characters to 2 and
code: textfield.restrict = "0-9";
...but that still allows 11 trough to 99.

How is it done ?

View Replies !    View Related
Restrict Text Input
I have a chatroom which uses htmlText.text to show the messages in a text area, but I don't want people entering html codes. So I decided to restrict the usage of the characters "< > { }". I set ^<>{} in the "restrict" field of the component inspector and it works fine. I'm just wondering if theres something I'm overlooking or if theres a better way. The thing I'm worried the most about is that I know theres a weird round-about way to insert characters with number codes or something and I want it fool-proof. My php script that the text input submits to will validate the info anyway, but I'd like it checked at both sides.

I believe the answer is as simple as using htmlentities for the message coming from flash to PHP, but I wanted to double-check. Maybe theres other security issues I should protect against?

View Replies !    View Related
Restrict Input Field To Float
hi all

i need to have a textfield which is restricted to a float with maximum 2 numbers before and 2 numbers after the point:

like that 34.12

is that possible???

please help

thank a lot

cheers

marcel

View Replies !    View Related
Restrict Char Input Of Textfield
Hi guys,
quick question,

Is it possible to restrict what it typed into an input textfeild. Actually what i am trying to do is restrict caps being used in a password textfield. So if the caps lock is on the user gets and message saying not to use caps?

Anyone

Cheers

View Replies !    View Related
Restrict An Input Text Field
Hey,

I would like to know how I can restrict an input text field to only contain Number and no letters or punctuation.

Also can you set a dynamic text field to display as Bold only when a certain value provides true?

Thanks again.
Joe.

View Replies !    View Related
Restrict The Amount Of Text In Input Box
Need to figure out how to restrict the amount of text in input box....

I'm working on a training CDRom where there are interactive pages for people to keep notes and do the tasks. I need to make sure that the boxes with the text input do not exceed their own size, ie not shift text up when there is no more space - if that makes sense....

I've tried counting the characters (to add the number into the 'MaxCaracters') via text mock up but it just doesn't quite seem to work perfectly, depending on text typed in, it works with certain bits of text and doesn't with other bits.... do to with the width of characters, I guess...

Does anyone know of anything that would help me here? Any thought? Tips? Or tricks?

View Replies !    View Related
Restrict Char Input Of Textfield
Hi guys,
quick question,

Is it possible to restrict what it typed into an input textfeild. Actually what i am trying to do is restrict caps being used in a password textfield. So if the caps lock is on the user gets and message saying not to use caps?

Anyone

Cheers

View Replies !    View Related
How To Restrict Input Text Based On Position?
Input text fields have a maxlength.
Input text fields have a restrict option so it's possible to block certain characters.
I would like to restrict input based on the caret's position in the textfield. Is this possible?
I'm able to retrieve the caret's position in the onChanged handler.
Can I clear the buffer in the onKeyDown?

Btw, the object I'm trying to put together is a textarea with one or more input fields inside. So, it's static text, followed by input text, followed by static text, etc.
My first try came down to putting textfields on top of each other, set autosize to true, and expand the static part along with the input part with an onchanged handler. Too bad this only works for one line of text. With more lines, wrapping becomes an issue.

Suggestions are most welcome.

---

Just thought of something. Is the textfield listening to the Key object? If so, can I detach it, and create my own handler especially for my textfield?

View Replies !    View Related
Howto Restrict Input Text In A Button?
Hi,

I know how to restrict an input text...


Code:
myInputtext.restrict = "a-z"
But when I create a button of this inputtext, it doesn't work anymore...

Can I solve this?

I already tried things like...


Code:
myButton.myInputtext.restrict = "a-z"
or...


Code:
_root.myInputtext.restrict = "a-z"
But that didn't work...

Paul

View Replies !    View Related
How To Restrict Characters In Input Text Field
Hi,

I have an Input Text field and I want it in such a way that user should not enter any character(any thing including all possible characters) in to that text field.

For that I use, flash's rectrict feature. The snippet of the code is:


Code:
myText.restrict = "";
whereas myText is Var name of the input text field.

In flash's help they have written that "If the value of the restrict property is an empty string, you cannot enter any character".

But when I publish the file, I discovered that I am able to enter anything inside text field. Am I wrong somewhere?

Any expert help in this regard?

Thanks,
Guy Logical

View Replies !    View Related
Input Text Length & Restrict Question
Hello, I have an input text in flash 8 that the user will enter their zip code... I want to restrict all characters except numbers... also, i have a search button next to it and when the search button is pressed I have a window open up... i only want the window to open up if there are 5 characters in the text field...

to restrict the characters i named the text instance custzip and added this actionscript to the keyframe.. but it does not work...


Code:
custzip.restrict = "0-9";
to only allow the window to open if there are 5 characters in custzip .. i added the following actionscript to the button


Code:
on (release) {
if (custzip.length=5) {
getURL("javascript:openWin('results.php?s_Dealer_Zip="+_level0.home.custzip+"&s_Dealer_Radius=50', '500', '500')", "", "POST");
}
}
can anyone explain what im doing wrong?

here is the site i am compiling.. i know it is not good but im fairly new at flash and actionscripting...


http://www.guttershell.com

View Replies !    View Related
Urgent: Restrict 'Enter Key' In Input Field
hi there,
can anyone point me out how to restrict the 'enter Key' (both main and on numpad) in an input field?
i.e. the user may NOT use the enter key and i'm having a multiline text input.

after some time i finally found the unicode "carriage return" escape but that does'tn work. Avoiding the spacebar however does work :s

fld.restrict = "^u000Du0020"


pls help ...!
thx
klikfabriek

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
Restrict Drag Area - Restrict Dragging If Pointer Goes Out Of Dragable Object
if press mouse and drag object it works but onpress pointer on stage I want to restrict draging. just want to restrict dragging if pointer goes out of dragable object
pls help

a.onPress = function () {
startDrag (a, false, 0, 110, 960, 110);
};
a.onRelease = function () {
stopDrag ();
};

View Replies !    View Related
No Restrict To Madness (restrict Property)
restrict (TextField.restrict property) is not reliable!
Using it in a very important Flash Form is actually driving me mad as users, despite this applied property, are able to enter ";" or "?" or ":" in Email Textfield on which the restrict property specifies: _root.mcEmail.restrict = "-_.@a-z0-9^A-Z";
What should be done to make this property work for good?

View Replies !    View Related
How To Restrict The "-" In An Input Field.
hey fellaz,

How can I restrict the - character in an input field?
cause this doesnt really work


ActionScript Code:
telefoon_txt.restrict = "0-9, -";

View Replies !    View Related
RESTRICT The
I was looking for some code to restrict the area for the "follow" action.

I got a nice elastic follow code, but I need to restrict this to some square area. If the mouse is out of this area then go back to the center. This is the actual code:
I frame:
physics0 = 0.25;
physics1 = 0.5;

II frame:
nothing...........

III frame:
xspeed = ((_root._xmouse-_x)*physics0)+(xspeed*physics1);
yspeed = ((_root._ymouse-_y)*physics0)+(yspeed*physics1);
// add the speed to the current position of the object
_x += xspeed;
_y += yspeed;
gotoAndPlay(2);

If you need to see the movie you could download from:
http://www.agvideo.tv/follow.fla

Any help will be appreciated.

View Replies !    View Related
Restrict SWF To Certain URL
How can I make it so that my .swf only plays on my domain ?

View Replies !    View Related
Help With Txt.restrict
Hi - new here, hoping you can help.

How on earth do you restrict "ENTER/CARRIAGE RETURN" key ASCII 13 on input textfields???

Cheers in advance
Rich

View Replies !    View Related
Help With Txt.restrict
Any ideas how to restrict "ENTER/CARRIAGE RETURN" ASCII 13 key.

I need multiple not single line, i am basically trying to get user to add <br /> instead of hitting return (or when return is pressed it inserts <br /> and no physical return occurs).

Please help!!

View Replies !    View Related
Restrict Drag In A X Value..?
in frame1 i have:
startDrag ("drag", true, 40, 0, 40, 220);
in frame2
setProperty ("button", _y, (drag._y)+1);

this code works fine for follow mouse but i wanna restrict this "follow" in half window (in x axis, like if x>60 stopDrag????)...how do i add the restriction?

View Replies !    View Related
How Can I Restrict Size?
One problem I keep running into is when I bring objects in from offstage, I get the offstage showing up in the browser window.
ex. http://www.galaxy-cities.com/Earth/b...bballjones.swf

How can I correct this?

baxart

View Replies !    View Related
How Do I Restrict Motion?
I have an MC that whose motion is controlled by mouse movement. I would like to restrict its motion to remain within a non-rectangular yet blocky shape... say, something like the shape of Texas but more blocky. How might I do this? thanks ;p

edit: woops, forgot to mention it's flash 5

View Replies !    View Related
GetURL Restrict
hello

So, I've got a client area on the site I'm working on. Its password
protected after the user has logged in it simply uses getURL to
go to /clientwhatever.htm, is there away to restrict access to that
page unless the user has entered it from the swf file??

so users can not paste in (whateversite/clientwhatever.htm)


cheers

View Replies !    View Related
Restrict A Textbox
I have a textbox which I want to restrict, so the user can only type in a capital A or B into the textbox.

How can I do this?

Any help would be grand!

Cheers

Jemes

View Replies !    View Related
How To Restrict The Movement?
Hi.
I need ur help.
I have a MC which moves left, right, up and down using the arrow keys.
I want the MC to move only in a specific area. For eg. I have a square of 300 x 300 and I want my MC to move only within this square.
It should not move outside the square.
How do it do this?
Plz help me in restricting the movement of the clip.
Thanks

View Replies !    View Related
Restrict Area.
Hi all,
This is a very nice question which I just came across. We all know how to simply restrict the draggable area on the stage with the help of a bounding box.
My question is how do we restict the area in a such a way that the user should be able to drag it only on that line. For example, we have a draggable area like a right angle, |_ and the object should be able to be dragged on the right angle lines only. The user should not be able to drag anywhere else.
If this is confusing, plz refer to the fla file which I am attaching.
Plz do help.

View Replies !    View Related
Restrict Problem...
When using the restrict command on a textfield forexample if I only want to be able to write the lower case "s" into a textfield I would type:

textfield.restrict = "s";

However when the caps lock key is active (Upper Case) and I press "s" a small "s" is allowed to appear in the textfield even though the caps lock is active. It seems that flash doesn't restrict the caps lock key.

Is there a way to restrict the caps lock key ? If not how can I detect if the Caps Lock is active or not. Forexample when the user opens the swf file how can I know if the Caps Lock is active or not ?

Thank you.

View Replies !    View Related
Restrict Swf Right Click Pop Up
Howdy folks, quick question.

How do I restrict what comes up when a user right clicks my swf file.

Ive seen swfs where all the "play" "quality" etc info doesnt come up when right clicked it just comes up with the single "about macromedia flash player"

I thought it would be an option in publish settings but i cant seem to find it, anyone know how to do this?

Thanks.

View Replies !    View Related
Restrict Coordinates
I have


Code:
clip._x = random(Stage.width);
clip._y = random(Stage.height);
so a duplicated appears at a random x,y coordinate using the whole width and height of stage...

Is there a way to restrict the possible locations to

min x = 100, max x = 500
min y = 100, max y = 500

instead of the whole stage?

thanks!

View Replies !    View Related
Restrict Use On Textbox
Hi guys
ok what im trying to do is restrict use on a text box to 0-9 . ,
the comma dont work everthing else done, i need to be able to use comma for forign people entering a stake amount (because they dont have a decimal point key so its easier to use comma for them)
anyways my code:

_root.mainWin.betWin["pBetObj" + j].restrict = "0-9 ,.";


-everything works apart from the comma,

View Replies !    View Related
Restrict The String
hi
i'm passing the operator as String to the textArea Component in AS 3.0 i.e ".,+,-,*,/
mainly i used this one for to make the calculator function
if the user enter the data as 25.5 means then user won't again type the Dot opertor


Can any one give indea for this one...

Thanks
Sk.......

View Replies !    View Related
TextInput.restrict -- A Better Way?
I have a text input interaction where I want to restrict the allowable characters AND play a sound when disallowed characters are entered.

Right now I have one messy IF condition to test for the allowable characters. I've been looking at ways to use the new RegExp with this, but it does not work when tested against textInput.restrict. I know there is an issue with type, but not sure how to deal with it.

Anyway, here's what I have so far:


Code:
import fl.controls.TextInput;
var inputText:TextInput= new TextInput();
inputText.move(100,100);
inputText.restrict="0-9;.,";//numbers, comma and period allowed
addChild(inputText);

var allowedText:RegExp = /(d|,|.)/;//numbers, comma and period allowed

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler, true);

function keyHandler(event:KeyboardEvent):void {
//the trace below always return true, even if the key is a letter
//trace(allowedText.test(String.fromCharCode(event.keyCode)));

if ((event.keyCode > 47)&&(event.keyCode<58)||(event.keyCode==188)|| event.keyCode==190)) {
trace((event.keyCode));

} else {
trace("disallowed key");
}
}

View Replies !    View Related
Restrict Actions To Swf
Can anyone tell me how I can restrict actions to the stage? I have objects that float dynamically when I move the mouse over the stage. If I publish my file as html and click on the area surrounding the stage the objects move...

View Replies !    View Related
Restrict Panning In Map App
Hey,

I've got a flash map with zoom and panning controls. Does anybody know a good way to stop the map from panning off the edge of the screen?

Cheers!

View Replies !    View Related
Text Restrict
ok, i understand how the myText.restict works, but what I want to do is if the user types in curse words, it filters
like
if they typed out ****, it would be censored to s**t, or something.
thanks

View Replies !    View Related
My_text.restrict
Is it possible to do not allow pressing 'Enter' key? I'm using my_text.restrict property.

P.S. it basically means that user can enter everything except Enter key for going to new line.

View Replies !    View Related
How Can I Restrict The Movement Of My Movieclip?
Hi there,

I've coupled a movieclip to the movements a the mouse with the following actionscript:

onClipEvent (enterFrame) {
_root.line._x = _root._xmouse;
_root.line._y = _root._ymouse;
}

So far so good, but I can't figure out how to restrict the movement within certain boundaries of the stage (this in order to prevent the movieclip to be shown only half on screen). Do I have to use hitTest, getBounds, or some other technique (and HOW do I have to use this?).

Thanks in advance!

Sander.

View Replies !    View Related
Restrict Access To Certain IP Addresses?
Hello,

Is it possible to restrict access to a flash movie only to users coming from certain IP address subnets (ie., 165.118.16.0/20)?

If so... how??

Please advise.

Thanks,
Glenn

View Replies !    View Related
TextField.restrict Issue
OK, This is what I'm doing:

I have a variable, which could be a word or a sentence, and textfield created with createTextField.

Say, for example, "The dog sleeps." My problem is with capital letters vs lower case letters.

What I want to do, is to restrict the input to only one letter at a time in the variable. For example, first I want to restrict it to only the capital "T", then only the "h", then "e", and so on.

I basically have this working, but for some reason, theTextField.restrict actionscript acts goofy. When it is restricted to capital "T", for example, and I type "t" in lowercase, it enters it in as capital, ignoring the need for the shift key. I want it so that the shift key is required to enter the capital letter.

The sentence must remain a modifiable variable, so I don't want to hardcode letters. Like I said, I have it working except for this.

Below is a simple script to help explain my point:

createTextField("mytext", 1, 10, 10, 530, 100);
Selection.setFocus("mytext");
mytext.variable = "input";
mytext.background = true;
mytext.type = "input";
mytext.restrict = "A";
mytext.multiline = true;
myformat = new TextFormat();
myformat.size = 35;
myformat.font = "Arial";
mytext.setNewTextFormat(myformat);

Notice it's restricted to a capital "A", but if you press a lowercase "a", it automatically converts it to uppercase, with the need for the shift key. It has the same issue with the lowercase to uppercase. Any help is greatly appreciated.

Thanks.

JEBoothjr

View Replies !    View Related
Restrict Movement Of Follower
I was looking for some code to restrict the area for the "follow" action.

I got a nice elastic follow code, but I need to restrict this to some square area. If the mouse is out of this area then go back to the center. This is the actual code:
I frame:
physics0 = 0.25;
physics1 = 0.5;

II frame:
nothing...........

III frame:
xspeed = ((_root._xmouse-_x)*physics0)+(xspeed*physics1);
yspeed = ((_root._ymouse-_y)*physics0)+(yspeed*physics1);
// add the speed to the current position of the object
_x += xspeed;
_y += yspeed;
gotoAndPlay(2);

If you need to see the movie you could download from:
http://www.agvideo.tv/follow.fla

Any help will be appreciated.

View Replies !    View Related
How I Restrict My Swf For Any Perticular Site
I want to make game which will work for only any perticular site which i define. like javascript "location.href" is any function in flash which detect site name from address bar.

View Replies !    View Related
Restrict Mouse Movement
hey guys, another question for ya, say I wanted to restrict mouse movent from going over say a box in the middle of the screen. like it has hit a wall... any help is greatly appreciated.
thanks
g.

View Replies !    View Related
Restrict Mouse Movements
Hey,
does anyone know how to restrict mouse movemtn? I need to make sure that mouse does't get outside 200x200 box. Or is there a way to disable Mouse click if the mouse outside the box. Thanks

View Replies !    View Related
How To Restrict Mouse Movement, +x, -x, +y, -y?
hello, how can I restrict the mouse downMovement, the mouse upMovement, the mouse leftMovement and the mouse rightMovement?
I tryed hitTest with no luck, could you help me out. I have attached a fla. file...

View Replies !    View Related
Restrict TextField Property
G'Day all,
I'm using the restrict property for a text box. When I use :

tbComments.restrict = "";

it doesn't restrict anything although acording to the documentation it is supposed to restrict everything. Can someone please help, I'm trying to stop people entering things into the text box at certain times.

View Replies !    View Related
Restrict A Dragged Symbol
Can someone help me with my code. I want the draggable blue bar to drag up and down only within the green area in the background. Additionnally, I would like to restrict the drag to the Top and Bottom of the blue bar not the center point.

View Replies !    View Related
Using Restrict 0-9 But Pos To Clear Text With A-z Key?
Hi guys
I am using restrict to stop users entering 0-9 into a text area. All works fine with one exception, when I highlight existing text and press a letter key it clears the content. Anyone know a way to stop this?
Thanks in advance
Ol

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved