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




Setting Focus To An Input Text



How do you set focus to an input text (like dynamic and static text, just inpu text)?



ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 11-23-2008, 01:16 PM


View Complete Forum Thread with Replies

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

Setting The Focus To A Input Text Box?
Hi,
I am making a simple quiz, you read the question, answer in a input text box and press go. the answer is checked and you go to the next question.

how do i set it so that on each question/answer page the users cursor is automatically in the input field. rather than having to move the mouse and click in it each time?
thx
Lev

Creating Keyboard Class - Setting The Focus To Input Text Fields
Hi all,

I am creating a virtual keyboard class, but haven't gotten very far on it. What I would like to do is load the virtual keyboard into any flash document, and use it to input letters into any input text field. I am a little stumped on how to do this, since with AS 2.0 I would just use a selection listener to find out what text field the keyboard has to write in. However in the latest version, it seems when I press a key on the virtual keyboard, you lose focus on the text field and the movieclip is focused instead!

Here is the code so far for the class:

ActionScript Code:
package
{
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;

    public class VirtualKeyboard extends MovieClip
    {
        private var keyboard:MovieClip;

        public function VirtualKeyboard(clip:MovieClip)
        {
            keyboard = clip;
           
            keyboard.keyq.buttonMode = true;           
            keyboard.keyq.addEventListener(MouseEvent.CLICK, onKeyPress);
        }
       
        private function onKeyPress(event:MouseEvent):void
        {
           
            if (event.target.name == "keyq")
            {
                trace("q");  // This is where I need the "q" to display in the selected text field i.e. textfield += "q"
            }
        }
    }
}

What would be the best way to do this? At the moment I only have the "q" button programmed on the keyboard, but the other buttons would be similar. If anyone could help me, it would be greatly appreciated. Thanks.

Setting Focus To An Input Box?
I have created this function


ActionScript Code:
function init() {
Selection.setFocus(typeText);
}

This is setting the focus to the typeText instance, however, I have two issues:

1) It is focusing on the second char within the input text field

2) Is it possible to have it so that the cursor appears, having the same effect as though someone was to click on the input text field. Reason being the backspace key won't work.

Thanks for your input.

Setting Focus On An Input Field When It Enters The Frame
I can set the focus to a input field via a button using:

PHP Code:



on (release) {
    Selection.setFocus("Name");





but how can envoke this without a button press? My animation plays and the text fields appear in the final frame and this is where I want it to setFocus. I tried Selection.setFocus("Name"); on the main timeline but that dont seem to work.

Cheers.

Setting Focus On An Input Field When It Enters The Frame
I can set the focus to a input field via a button using:

PHP Code:



on (release) {
    Selection.setFocus("Name");





but how can envoke this without a button press? My animation plays and the text fields appear in the final frame and this is where I want it to setFocus. I tried Selection.setFocus("Name"); on the main timeline but that dont seem to work.

Cheers.

Setting Focus To First Text Field In Flash Form
I have some text fields and when the movie is exported or loaded I need the
cursor to be focused to the first textfield in the form

Please Reply soon Its urgent

Thank U,
S. Rajasingh Samuel

Focus On Input Text
Is it posssible to set frame action to focus on input text box?

Focus On Input Text
Is it posssible to set frame action to focus on input text box? I want user to be able to start writing inside that text box as soon as frame is loaded.

Thanks

How To Set Focus On A Text Input Box?
Hi ya all,

I am making a flash movie for a web page. I have a text in put box. I want it so that when I click a button it automatically sets focus on the text field and place’s the cursor in the in put box at the end of the text that is in the text box. I would normally use:

On (press){
Selection.setFocus("nickname");
Selection.setSelection(length(/:nickname), length(/:nickname));
}
with the text box name being like "/:nickname"
and with a instance name like "nickname"

witch would normally place focus on the input box and place the cursor at the end of what ever text was in the text input box. How ever I am using flash player 7 action script 2, which means I can not use the “:/nickname” as “;/” doesn’t work in action script 2. Also the “ Selection.setFocus("nickname"); ” doesn’t seam to work either. Can some one tell me what code I need to set focus on a text input box and put the cursor at the end of the text that is in the input box please?

I also tried the tab index order method

this.Name.tabIndex = 0;

But with no luck, can any one please help me????????


Hope this all make sense lol

Cheers in advance
Rabid Lemming

Creating Focus On Input Text
I created three inputboxes on the same movie and i want the flash to put the focus on no2 which is name(variable) when it start.
how can i do this and to keep this field blinking and ready to edit at the run time?

Set Focus And Input Text Fields
I wrote a quiz that has 20 input text fields. Is there any way to set the order of focus when someone uses the tab button?

How Can You Focus After The Last Character In Input Text?
ok

im trying to set focus to an input text field

but i do not want to "highlight" the text
cause i need the color to remain green (00ff00)

so is there a way to set focus after the last character typed in by the user?

keeping in mind that the number of characters will vary from time to time
(might be 5 or 50 characters entered)

please let me know if this does not make sense

thanks a lot and free for all that help the capn

later
-c

Set Focus And Input Text Fields
I have 6 input text boxes. I have some buttons that I would like to have insert foreign text symbols into the last textbox to have focus.

I was using the following functions on a button...

myShuffle=sharedobject.getLocal("stuff");

function myFocus() {
mylength = length(myTextbox);
Selection.setFocus("_root.myTextbox");
Selection.setSelection(mylength, mylength);
}

function accentA() {
myShuffle.data.accenteda = _root.myTextbox+"á";
_root.myTextbox = myShuffle.data.accenteda;
}
On the button I put the following code...

on (press, keyPress "1") {
_root.accentA();
}
on (release, keyPress "0") {
_root.myFocus();
}


This works fine if I only have one textbox. But I don't know how to make it work if I have several. Any help would be appreciated. Thanks.

Focus And Input Text Boxes
I have 6 input text boxes. I have some buttons that I would like to have insert foreign text symbols into the last textbox to have focus.

I'm calling the following functions from a button...

myShuffle=sharedobject.getLocal("stuff");

function myFocus() {
mylength = length(myTextbox);
Selection.setFocus("_root.myTextbox");
Selection.setSelection(mylength, mylength);
}

function accentA() {
myShuffle.data.accenteda = _root.myTextbox+"á";
_root.myTextbox = myShuffle.data.accenteda;
}

On the button I put the following code...

on (press, keyPress "1") {
_root.accentA();
}
on (release, keyPress "0") {
_root.myFocus();
}


This works fine if I only have one textbox. But I don't know how to make it work if I have several and want the symbol to be placed in the last textbox to have focus. Any help would be appreciated. Thanks.

Focus Back To Input Text Box? How
1)I have a input text box and a push button next to it.
2)after clicking on the push button, i want the control to be back in the text box

How to achieve this.

Grateful if somebody can help

Input Text Clear When Focus
Hello.
I have to input feilds. Inside the feilds (through variables) I have "username" writen. How can I clear this feild when the user focuses on the feild?
In a frame script I have:

if (selection.getFocus() == _level0.loginPageMC.userTxt) {
userTxt = "";
}

and this is not working.
Any help?
Thanks in advance.
1M.

I Can't Lost Focus Of My Input Text
Somebody help me!!
Need a way to always send back the focus to input text when mouse
is down in other area of movie...

Focus Input Text Field
Hello,

In the attached movie I've got a simple input Text Field
I need that when the movie loads I will see the blinking cursur
inside the text filed and won't have to press it in order to write.
It will be focused.

Any help is needed

[F8] Remove Focus On Input Text
Hi all,

I have a little issue I can't seem to figure out.

I have a file with 2 scenes.

In the first scene the user can enter their name and email.

Then they submit it and go to scene 2.

When they click to go back to scene 1, the text in the name field is selected.

Is there any way to have it not be selected?

See the attahced pic for an example.

Thanks,
Tbone

Text Input Focus Issue
Looking to see if anyone has seen this issue:

I have an empty flash movie that loads an xml file and renders it to html. The xml file has the links to any media like jpgs and other swfs. Everything works fine except if I load a swf that has text input fields. In Firefox (and Safari), it simply won't let the user get focus of these text input fields to enter data. In IE windows, it works perfectly, but not Firefox.

If I load the swf with the text input fields by itself (as opposed to this xml setup), it works fine everywhere.

Anyone know of a fix for this? Btw, I'm working in Flash CS3 and AS3.

Input Text Focus Functionality
I have an input text box set to variable 'memail'. The text box has no instance name (not sure if that makes any difference).

When the visitor arrives on the 'page' the input box displays the text "please enter your email address".

When someone clicks on the textbox (i.e. sets focus to it) I want that text to clear, I guess by changing the variable:


Code:
memail = "";
My question is how do I detect that focus has been set to the text field. I guess I'm looking for something along the lines of:


Code:
on (setFocusToTextField){
memail = "";
}
Can anyone please help?

Kill Focus On Input Text?
so there must be a way - I've tried
Selection.setFocus(null) with no avail - anyone know how to stop that dreaded blinking cursor once you've clicked in the box?

ie:

I want to type in some text, submit it, but then, the cursor no longer blinks in that box. (which i assume would mean the focus is killed)

any ideas?


much appreciated as always!

How To Maintain Focus In Input Text Box?
I am a complete newbie with Flash MX, ActionScript, and everything in between. So here's my situation.

I want to make it so the user has to type in a password to move forward with the Flash presentation. When he presses OK, it takes him to further into the presentation (i.e. Frame 20).

On my login screen, I have a couple of layers that are animated. Thus, I need these animations to keep looping. So what did I do? At the end of the animation, I put in code to GotoAndPlay(1).

Now here's the problem... When someone's trying to type in the password, when it loops (Gotoandplay), the input box loses focus. To remedy this situation, for frame 1, I put in the code: Selection.setFocus("txtPassword").

What happens? Everytime it sets focus, everything gets highlighted in the input text field.

As you can imagine, it is a headache for anyone who is trying to type in the password because every few seconds, the whole thing gets highlighted and he accidently types over it.

Any suggestions?





























Edited: 12/03/2006 at 10:03:42 AM by AirDynamicAir

Focus Input Text Field
I'm trying to set up an email form within a flash movie. I want to have example text in teh input fields, but don't want the text to have to be deleted when someone clicks inside of the text field. I just need the text to disappear and the box to be emptied out.

Is there a way to do this in flash?

Cant Remove Focus From Input Text Field
Hi,
I have a swf that is having problems only when I load a movie.

someButton.onRelease = function(){
empty_mc.loadMovie("C://maps/"+jpgName_txt.text+".jpg");
}

I noticed that the movie does not run right only when the cursor is still bliking in the input text field. I will input text in the input field but the cursor continues to remain in the field even after clicking the "someButton".

I tried to change the function to

loadMovie("c://maps/"+jpgName_txt.text+".jpg",empty_mc);

but is still has a problem. The problem being that when I click another button in the program, sometimes it will not work and othertimes it will.
When I remove the input field and hard code the import the loadmovie it works fine.

Any idea???? I'm loosing my hair..........

Thanks in advance.....[

Selecting All Text In An Input Field On Focus
Hello,

I am wondering how I can make actionscript highlight all the text in a text input field when I click in it. I have been able to accomplish this if I manually change the focus in actionscript, but I can't get it to work if I use the onSetFocus function for that text box.

Thanks for the help
Tim


Code:
this.createTextField("txtTest", this.getNextHighestDepth(), 10, 20, 100, 20);
txtTest.text = "My name is Barbara";
txtTest.onSetFocus = function() {
trace("I got focus");
Selection.setSelection(0,10);
};

Input Text Box Turning Black On Focus
Hi
I was wondering if anyone had encountered this problem before.
When i set my cursor onto a input text field, it turns black, making it impossible to readwhat you typed in it.

Is this an error my end perhaps?
Thanks

Input Text Box Turning Black On Focus
Hi
I was wondering if anyone had encountered this problem before.
When i set my cursor onto a input text field, it turns black, making it impossible to readwhat you typed in it.

Is this an error my end perhaps?
Thanks

On(focus){ Change Input Text Field Bg Color?
www.richcastillo.com
his contact page has this effect... can someone show me how?

thanks

Button Loses Focus When Passing To Text Input
I'm using the following function to pass characters to 2 text input components, but sometimes (and much more often with the "Password" field), after I click a button, the button loses focus and I have to move the mouse to regain the rollover state and be able to click the button again. When I've lost focus, if I click the mouse, it just changes the button to the rollover state but doesn't pass the value...

Here's the code:

Code:
var Focus:String = "";
function KeyPadButtonClick(_id:Number) {
// default the focus to the UserID
if (this.Focus == "") {
this.Focus = "UserID";
}
if (this.Focus == "UserID") {
this.UserID.text = this.UserID.text+_id.toString();
}
if (this.Focus == "Password") {
this.Password.text = this.Password.text+_id.toString();
}
}
The zip file is attached.

Any ideas???

TIA!!!

Flash Player 8 Input Text Focus Problem
I spent a good half hour trying to figure out why a cursor was remaining inside the input text field after I click outside of the field. Figured that this is happening only when I'm publishing for Flash player 8.

The onKillFocus is triggered correctly but the cursor still remains blinking inside the text field.

Does anyone have any idea how to get it 'unfocused'? Thanks!

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 Text Box Inside Clips Can't Recieve Focus
I've got a menu system in which the buttons(movieclips) move around (using the tween class) and resize to become the actual site pages/areas.

This works great. I'm using an external .as file to control most of the movement.

The problem lies in a conflict between the clip's mouse events (onRelease)
and being able to access input text boxes inside a clip inside that clip.

In other words you can't click in the input text boxes because the onRelease for the ._parent._parent clip is always being triggered.

I have a var I can check to see if the clip has opened (okay to access dynamic text boxes and no need for main mouse events) but that doesn't seem to kill the .onRelease function for the clip.


Code:
clipA.onRelease=function(){
//the variable below traces "true" when the menu item clip has expanded
trace(this.isOpen+": check on open var");
if(this.isOpen==true){
stop();
//tried this to see if I could get focus on the first text box
clipA.contact.quickContact.nameText.setFocus;
}else{
trace(_root.motionFinished);
if(_root.motionFinished==true){
_root.expandClip=97;
nclip1=clipB;
nclip2=clipC;
nclip3=clipD;
nclip4=clipE;

if(selClip!=clipA){
if(_root.windowOpen==true){
_root.nextSelClip=clipA;




selClip.gotoAndPlay("contract");
slaves.moveBack(nclip1);
slaves.moveBack(nclip2);
slaves.moveBack(nclip3);
slaves.moveBack(nclip4);
slaves.moveBack(nextSelClip);


}else{


_root.nextSelClip=clipA;
_root.selClipSide=clipA._x;

selClip=clipA;

selInPos=1;
pos3=clipA;
trace(selClip);
firstTween();
}
}
}
}
}
my head hurts.

Setting Input Text Using VB6
Hi I'm a bit stuck here....

I need to set the text in a Flash input text area using VB6. Now I can do this normally using something along the lines of:

swfMovie.setVariable "MyVariable", MyText

where MyVariable is the Var name of the input text area and MyText is the VB variable which holds the text to be set

However problems occur when the input text area occurs inside a movieclip which is added to main flash movie - i.e. you have the main movie, and this movie is (dynamically) added to the main movie, which contains the input text area.

The added movie clip has an instance name in Flash (MyAddedMovie), so I've tried in VB something like:

swfMovie.setVariable "MyAddedMovie.MyVariable", MyText

but nothing shows

Any ideas or help please?

Thanks
Dan

Setting Input Text To A Variable
heres the code:

_root.username = _root.adminlogin.username;
_root.pass = _root.adminlogin.pass;
loadVariables("/admin.php?username="+username+"&password="+pass,"" ,"POST");

here's the error:

Error opening URL "/admin.php?username=_level0.adminlogin.username&pas sword=_level0.adminlogin.pass"

the URL exists. the PHP works.

how can i send the contents of the input fields (username/pass) to the php file without that _level0.adminlogin. garbage?

Setting An Input Text As Selected
Hey all- Does anyone know how to have an input box load as selected, I mean where when the page comes up the cursor is blinking in the first input box, ready to type? Any help would be greatly appreciated.

thanks
cognizen

Setting An Input Text As Selected
Hey all- Does anyone know how to have an input box load as selected, I mean where when the page comes up the cursor is blinking in the first input box, ready to type? Any help would be greatly appreciated.

thanks
cognizen

Setting Object Fill By Input Text
What I was trying to do was some kind of percentage fill of an object by putting in the percentage in an input text textbox.

So if you put in 50 the object would be half filled with color.

Could some one help me out here?

Thanx

Setting Variables Using Input Text Boxes
Setting variables. Have a look at the file. Current height and width are both set at 200. I dont think i got the scripting right, or it may be in the wrong place. Thanks in advance.

Setting Variables Using Input Text Boxes
Setting variables. Have a look at the file. Current height and width are both set at 200. I dont think i got the scripting right, or it may be in the wrong place. Thanks in advance.

Setting Input Text To Dynamic Text
ok here's my problem:

i have a few textfields that are at first dynamic.
when clicked a button they change to input text. that works

in my script i have this :


Code:
editFields = [Name, lastname, adress, phone, email];
later in the script when clicked the button

Code:
editFields[i].type = "input";
all ok up untill now...

i created another button and when clicked on that i want all textfields again set to Inputtext, al except the 'name'textfield
that one has to stay dynamic.

my problem is that i can't figure out how to keep one textfield
dynamic.


anyone know how i can achieve this ?!

thnx in advange

assenoost

Setting The Background Color Of The Selection When Text Selected (input TextField)
My input TextField has a black background. The problem is, when some text is enter and then selected, the selection background color remains black and the selected text remains white. Because of this it's imposible to tell that the text has been selected. Is there a way to change the selection background color, or do I really have to write a custom textfield? :(

Setting X Pos To Input Text Box Text
This may be quite the n00bish question, but I really can't figure out how to change the properties, such as the x position of a movieclip, based on what is inputed into an input text box. I'm really confused about the "var name" option in the properties box... Anyways, here's my code, and please tell me what's wrong!!!
(the movieclip is called box_mc, and this script is on the first frame)
(I gave the txt box a var name of input)

box_mc.onEnterFrame = function() {
box_mc._x = input;
};

It just don't work!

Setting The Focus
Does anyone know how to set the focus on a swf file when it is loaded into a browser window without having to click on it and without having a text input window? Thanks.

Setting Focus
Does anyone know the html or javascript code to set focus on the flash object (swf) in a html document when the html page loads?
Thanks.

Setting The Focus
Does anyone know the html or javascript code to set focus on the flash object (swf) in a html document when the html page loads?
Thanks.

Setting Focus
Hi,

I am having trouble with setting the focus onto my movie. This may not be a specific flash answer, but does anyone know how to do this?

thanks

Kevin

Re-setting Focus ?
I have 2 rows of 4 input fields in a scene....

I'm trying to get the focus for my user input fields to TAB all the way down one column, and then over to the next column and down, but it criss-crosses over from row to row, all the way down...

any idea how I can fix this...all my input variable names are different...

Thanks...

D...

Setting Focus
I am trying to set the focus on a text field in my flash program. I have an instance of a MC called "NameBox" which contains the text box. Here is the AS that I have on the frame:

Selection.setFocus(_root.NameBox);

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