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




Lost Focus On Input TextField



I have this problem I'm unable to solve and I've been pulling my hair out. I'm creating an 'input' textField and I don't want to initially add any text into it so I set my_txt.text = ""; The problem is that if the textField is given no content I can also not select it to add content but if I add some blank spaces I am able to select the textField and type in some text. If you cut and past and run the script below you will see what I mean. Run it as is and then change my_txt.text = " ";

(I've got the Font linked in the Library. It works if there is text int he field)

Something else that might be related: When I set the font, colour or size of the input field, the type in some text, then change the formatting (colour, font), then select right at the end of the input box and type some more text it picks up the previous format settings so I have two different fonts in the textbox.


this.createTextField("my_txt", 1, 10, 10, 100, 40);
my_txt.border = true;
my_txt.multiline = false;
my_txt.wordWrap = false;
my_txt.autoSize = false;
//
my_txt.selectable = true;
my_txt.type = "input";
//
// set format
this.myTextFormat = new TextFormat();
this.myTextFormat.size = 12;
this.myTextFormat.bold = true;
this.myTextFormat.align = "left";
this.myTextFormat.font = "Arial";
this.myTextFormat.color = "0x000000";
// set text
my_txt.text = "";
// embed font
my_txt.embedFonts = true;
// apply formatting
my_txt.setTextFormat(this.myTextFormat);



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 04-19-2005, 12:54 AM


View Complete Forum Thread with Replies

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

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 On Input Textfield
I've made some kind of form with a couple of input textfields. Now, what I want is that the first input textfield is active from the start so users can start typing right away without having to select the first input field first. Is this possible??

Set Input Textfield Focus.
I want to set focus on input textfield in flash Mx 2004 i.e. active cursor will display in it.

in flash Mx Selection.setFocus ("my_Txt");

code working properly but it not support Mx2004

can anybody provide solution.

thanks

Set Focus To A Input Textfield
Hello i have a "stupid" problem...
in as 2.0 i used setFocus for give focus a my textfield input.
I have this situation:

MainApplication - (document class)


LoginInterface - Sprite (child of MainApplication)

Login - Sprite (child of LoginIntefac)

ok

within Login a create 3 input textfield

customer
user
password

I want set the focus to third field password.

I try FocusManager but i have error..

how can i resolve and give focus to password textfield?

Set Focus To Input Textfield
Hello i have a "stupid" problem...
in as 2.0 i used setFocus for give focus a my textfield input.
I have this situation:

MainApplication - (document class)


LoginInterface - Sprite (child of MainApplication)

Login - Sprite (child of LoginIntefac)

ok

within Login a create 3 input textfield

customer
user
password

I want set the focus to third field password.

I try FocusManager but i have error..

how can i resolve and give focus to password textfield?

Zooming Input Textfield On Focus
Hi All

I am making one form in flash in which have good number of input textfield in it.
We all know that when we click tab, cursor switches to next input textfield.

What i want is that when movie publish the first textfield should come out marginally (get zoomed) with bigger font size and focus.

After entering text if user clicks the tab first textfiled should set back to the original( like other textfiled except nextone) size with small original font size along with the text that user have entered in zoom(or bigger) input textfield and next textfield should get bigger or zoomed similiarly like the first textfield again with focus.

this goes on and on.

Please help me out in this. Please also comment about my explanation skills. Was i comprehensive? Do i know well how to put a question.

I welcome your opinion. Thanks in advance.

Regards

AsiaMG

Focus Stuck In INPUT Textfield After Hitting Enter Multiple Times
Ok this was just brought to my attention...I have a search input textfield on stage that searches my list component...there is no search button, instead the search is performed 1 second after the user stops typing...(this is done with a key listener)...however the input focus gets stuck in the textfield if you type something (anything) and hit the enter key multiple times...I hit it like 5-10 real quick....then I tried to click my address bar in the browser, and I am unable to type a new URL...it just continues to type in the input text field on screen...any ideas? This doesn't happen every time...but for the most part the focus gets stuck when you hit enter a few times...

http://www.expocadvr.com/new/default.html

let me know if you guys know anything about this...

Focus Stuck In INPUT Textfield After Hitting Enter Multiple Times
Ok this was just brought to my attention...I have a search input textfield on stage that searches my list component...there is no search button, instead the search is performed 1 second after the user stops typing...(this is done with a key listener)...however the input focus gets stuck in the textfield if you type something (anything) and hit the enter key multiple times...I hit it like 5-10 real quick....then I tried to click my address bar in the browser, and I am unable to type a new URL...it just continues to type in the input text field on screen...any ideas? This doesn't happen every time...but for the most part the focus gets stuck when you hit enter a few times...

http://www.expocadvr.com/new/default.html

let me know if you guys know anything about this...

On Windows Lost Focus Javascript
I just finished this game:
http://www.disarea.com/work/office_space/
and I need one feature to implement - game pause on HTML window loosing focus. I got some javascript that does it, but it doesn't work right (does just in one version of IE). Did somebody founf any solution that works?

Lost Focus After Return From FULL_SCREEN
The following code example illustrates the problem below that I experience e.g. under OSX/Safari (see point 6). Any idea how to prevent the loss of focus when returning from full screen mode?

1. App starts

2. User clicks

3. Full Screen

4. User clicks

5. Normal Screen

6. User has to click twice (first click to get focus)

7. Full Screen

Code example:


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

    public class Test extends Sprite {
        public function Test() {
            stage.addEventListener(MouseEvent.CLICK, onClick);
        }

        private function onClick(event:MouseEvent):void {
            if (stage.displayState == StageDisplayState.FULL_SCREEN)
                stage.displayState = StageDisplayState.NORMAL;
            else
                stage.displayState = StageDisplayState.FULL_SCREEN;
        }
    }
}

Check If Flash Has Lost Focus
Hi,

I have a select form field that I have recreated in Flash to act like an html select form field. I need a way to detect that my Flash movie is no longer in focus (when clicking on the html page) and so, hiding the dropdown options.

If you see the way an html select field works, you can click the dropdown and move the cursor around the screen without the dropdown closing. But if you click anywhere on the page, the select dropdown options will disappear again. I’ve tried different ideas but I can’t find a solution. onfocus in JavaScript isn’t well supported in Safari or Gecko and I’d prefer ActionScript to detect the focus rather than JavaScript if possible.

Thanks in advance!

Text Field - Lost Focus
I have few input text fields on my Scene. Can I manage to lost focus from any text filed by clicking anywhere on Scene beside on text fields?

Now if I click anywhere on the Scene, last text field lost and again gets focus…

How to avoid that???

Thanks,

Bojan

Focus (I Think) Question (totally Lost)
Hey everyone,

I was just asked to add a new piece of functionality to add this menu that I have designed:

http://www.whatadewitt.com/coolriot/menubar.html

As you can see, if you click the top bar the menu will expand and collapse. Good, great, awesome.

What I need to add is some AS code that will make it so that when a user clicks off of the .swf area, the thing will collapse... I think it's a matter of focus, but I am so lost... anyone have anything that may be able to help me out?

Note: This is just on my personal site right now, it is not totally functional on that, but you'll be able to get the idea of what I want without having everything working.


Thanks a ton, K-Crew!

--D

Text Field - Lost Focus
I have few input text fields on my Scene. Can I manage to lost focus from any text filed by clicking anywhere on Scene beside on text fields?

Now if I click anywhere on the Scene, last text field lost and again gets focus…

How to avoid that???

Thanks,

Bojan

Stopping Sound On Lost Focus
Hey,
I'm exporting my flash movie as an .exe projector to go on a cd. The flash movie has some URL links which open up a webpage in a browser, how do i make my looping music in flash fade out when the actual flash movie loses focus?

Thanks.

Focus Lost After A Single Click
Hello all,

I have a video recording flash app which is on frame 2. On frame 1 there is the intro screen and you have to click it to get to the 2nd frame. At this point Flash asks for the webcam/mic access. I have to click twice on allow (sometimes more) to enter my app. Its because its not clickable because of loss of Focus (i think).

How can I get a Flash app to have all Focus as long as its clicked on once? If thats even possible.

Thanks all

Pausing Flash Movie On Focus Lost
Is there any way thru ActionScript to detect the loss of focus at the Flash movie level, eg. browser minimize or selection of another window, I would like to auto-pause my game at this point. I managed to create a reasonably effective solution using event handlers within the EMBED and OBJECT tags in the HTML but I would rather have my Flash movie do the work, onBlur and onFocus don't behave particularly well across different browsers anyway.

Thanks,
Ronny.

Fullscreen Mode Minimizes When Focus Is Lost
I'm trying to watch a flash video in fullscreen mode on a second monitor but whenever I click anything that causes the flash video to lose focus the video minimizes and goes to it's normal size. Is there a fix for this? or at least a way to zoom in on the video so its nearly fullscreen? neither IE8 or firefox 3's zoom functions will zoom in on flash.

Thanks

Close The Combobox On Application Focus Lost.
Hi,

I have created desktop flash application and I have used Combobox in it. When user opens the combobox and then switch to another aplication and again come back to flash application the combox remains open. I want to close that combox box. Where or how should I write code to close that combobox on application focus lost? I have used Multimedia Zinc 2.5 to create exe with transperant background. So if any MDM command/event availabe that also will work. Please let me know the solution.....

Flash Lost Focus In Browser Window
i have a input text field in a flash file. I have published this flash movie in html format. when i switch between multiple browser windows i lost focus from the text field.
I can again focus on this text field by clicking on it. but what i want is to get the focus by pressing the tab key. or any other key how it can be done?

After Killing The Focus On A Textfield, The Textfield Remains Selected. Why ?
Hi.
I have a serious problem with the deselecting text when I kill the focus on a textfield.
to see better what I am trying to say, please clcick this link: http://www.eurogaz.ro/rring/expert/

[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.

I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.

I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.

Anyone got a better idea?

Cheers
Paul

[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.

I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.

I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.

Anyone got a better idea?

Cheers
Paul

How To Set The Focus On A Textfield
I have a textfield in my movie.

What i want that when the movie loads the curser automatically should be there in the textbox.

please help me this is very very urgent.

cheers
Ritesh

Textfield Focus
is there a way to tell if a certain textfield has focus?
i want the user to be able to press enter to submit a form
but only if the input textfield has focus
any help would b appreciated
thanks
Lektran

Textfield Focus MX
I'm trying to get the focus to be set on an input textfield as soon as the movie is run, so the user doesn't have to click the textfield with the mouse. Any ideas?

All I have is the code to create the textfield (which is taken from the Flash Help files.


Code:
this.createTextField("blah", 1, 0, 0, 200, 20);
blah.type = "input";
blah.border = true;
blah.background = true;
blah.backgroundColor = 0xA4660B;
blah.onSetFocus = function (oldFocus) { this.backgroundColor = 0xF5BF70; }
blah.onKillFocus = function (newFocus) { this.backgroundColor = 0xA4660B; }



thanks.

Textfield Focus
Hi there,

Couldn't find an answer here on the following question:

How do set the focus on a input textfield by default?
As soon as the field appears it should be active.

cheers,
Albert

How Do I Focus A Textfield?
I have a input textfield inside a movieclip, how do i set focus to this textfield?
stage.focus=mytxt aint working!

How To Set Focus On Textfield?
I have a movieclip, and inside it i have a input textfield, how do i set focus to this textfield?

TextField Keeps Focus
Hi,

I have the following problem:
On my stage sits a MC: personTab.nameBase. Inside the nameBase clip there are 10 input fields named input## (numbered from 0 - 9).
When I click one of these fields the cursor starts blinking in the field which is clicked. This is OK, but the problem is that the field doesn't loose focus unless a component is clicked (radiobutton, combobox etc.).
I put in a listener to trace what happens:
In the onSetFocus event I get the target of the clicked field and when I click the mouse somewhere on stage (where no component is placed I get null as a target, but when I release the mousebutton, the last selected field receives focus again and the target of the field is returned again (instead of null). The onKillFocus event doesn't return a thing. I already tried handling the focus in the onSetFocus event in the following manner:
var clip:Array = newFocus._name.split(".");
if (substring(newFocus._name, 1, 5) == "input") {
var clipID:String = substring(newFocus._name, 6, newFocus._name.length);
_global.activeField = clipID;
} else {
if(!newFocus._name){
//remove focus from textFields
Selection.setFocus(null);
}
delete _global.activeField;
}
But there is no response to Selecion.setFocus(null), the last selected input field keeps getting focus after the mouse is clicked on somewhere else on stage (but not on a component, or other text field).

I hope someone can help me out. Thanks in advance.

Best regards,
Rick.

AS3 TextField Set Focus
Hi Team,

I am trying to get MouseCursor focus automatically on Input textFiled

i tried with

function run (event:Event) {
my_txt.stage.focus=my_txt;
}



my_txt.addEventListener(Event.ENTER_FRAME,run)

it is working but it doent show cursor blinking please help me soon...........

Set Focus On TextField
Hi guys,

I want to focus the textfield with a cursor on it without clicking on the same and without using Ifocusmanager as I have taken the textField.

I have tried stage.focus but it doesn't seem to work the way I want. please help me..

[F8] Input Textfield Inside A Dynamic Textfield?
Hi,

Is it possible to place an input textfield inside a dynamic textfield?

I'd like to replace the variable, this.nTotal, below with an input textfield.
Is there some way to do this?

this.txtComplete.text = "There are " + this.nTotal + " pages in " + this.sGirlName + "'s book.";

Thanks!

Losing Focus From Textfield ...
Hi,
Can be MX ...
I would like after pressing enter to lose focus from textfield.
I have only 1 input field so construction: Selection.setFocus(""); probably can't make focus lose from textfield. Can anybody tell me how can I do this?

Lee

Set Focus To A Textfield (flash 5)
i'm having some problems with setting focus on a particular textfield, an the actionscript dictionary isn't very clear about setting the focus...

can anyone give me some profound information about this issue. code examples would be nice.

Onload Focus TextField
Try this in an swf.

TextField on stage instance named myField


Code:
Selection.setFocus(myField)
if I'm not mistaken ths should place your cursor on the field when you export. Now view this in the browser, but as soon as it load start typing, you aren't able to becuase the swf is not in focus i think so you actually have to tab once or twice, or click on the swf to actually get to the field that is focused in the swf.

How can i make sure that Flash is focused in the browser so that when i load it i could just start typing and word will show up in my field, with having to Tad or use my mouse?

Thanks a bunch

Loaded Swf With Textfield Focus
In flash MX i am loading a swf into a movieclip on my main timeline. Inside my loaded swf I have a textfield that I want to have focus upon entering the frame.

THis code loads the swf into a the movie clip on my maintimeline of my "loader movie."


Code:
this.onEnterFrame = function() {
loadMovie("wb_04_f.swf", _root.mov_loader);
};


Inside my loaded swf I have the textfield with this code on the first frame, where cashier is the instance name of my textfield:


Code:
Selection.setFocus(_root.mov_loader.cashier);


Any ideas on how to get the focus to be on the textfield within the loaded swf!?

Re-focus Textfield On Mouse Down
Is there a way to send focus back to a textfield if a user clicks the mouse on the stage somewhere else? Basically I have 3 or 4 textfields all working with tabbing order. However I want to lock the user into always having focus on one of these textfields, so that if they click the mouse(by accident or on purpose) the focus goes back to whichever textfield was previoiusly focused on... Anyone every handle this before or know away around it?
I think it may have something to do with a Listener and oldFocus vs newFocus, but I haven't been able to get it to work.

Set Focus To Autosize Textfield
Help!

Is it possible to set focus to a input textfield
that has autoSize property set true?

I tried even change the autoSize property after setting focus and still the textfield loses focus.

this.my_textfield.onSetFocus = function(oldFocus){
this.autoSize = true;
};

[F8] Remove TextField Focus
Hi,

I have a movie that has four different input text fields, all in separate movieClips. Inside each movie clip I have code that listens for the 'Enter' key to be pressed, and if it is, it stores the value and turns the focus off of that textField...which works great.


Code:
txt.onKeyDown = function(){
if (Key.isDown(Key.ENTER) && eval(Selection.getFocus()) == this){
slider_mc.gotoAndStop(1);
Selection.setFocus(null);
}
}
My problem is that I want it so that if the focus is on one of the textFields, if they click anywhere outside any of the textFields, I want the cursor to disappear from the textField it was in, and all focus to be lost.

I tried doing this, by putting


Code:
Selection.setFocus(null);
on the root, but the cursor remains in the textField...which is weird since it worked in the onKeyDown function above.

Any ideas??

Thanks!
-b.

Textfield Focus Issues..
I seem to have encountered a problem. I have a button that i can repeatedly click to perform an action which works fine. however i have added a textfield, now when i click the textfield then click my button it only works on the first click! repeated clicks does nothing until i move the mouse slightly. At a guess i think the textfield is taking focus away from my button, the same sort of think happens with comboboxes.

anyone had this and have a resolution.

Set Focus To Textfield Manually
hello,

is it possible to set the keyboardfocus to a certain text with actionscript code?

i have been playing around with FocusManager and Textfield.setSelection() as well as the focus property of the stage but without any success.

thanks a lot for any help on this issue.

Textfield Set Cursor Focus At The End
Hi,

I am kinda stuck in this issue for which i have been banging my head but havnt found any sort of solution

The Problem is i have a Textfield..and i want the cursor on that textfield at the end always. For example.. whenever there is an event like change.. mouse click i want the cursor to be at last so that there is no way that someone accidently put the charectors in between.

i tried stage.focus but to no avail.

any help is appriciated...

TextField Focus Check
Hi,

How do you check if a textfield has the cursor flashing in it or when you move the focus out of it by clickin anywhere else?


Thanks inadvance for your help.
Cheers,
Jas

Clear Focus From Textfield
I have a field that a user can enter data and then push a button to submit that data. The problem I'm having is I can't figure out how to remove the textfield focus(get rid of the blinking cursor) after the user presses the button. Does anyone know how this is done?

Textfield Focus With Flashing Bar
Hi Guys,

I'm trying to make Flash automatically focus on an input textfield (not the TextInput component object, but a textfield object with type set to input) when the user enters the page. I want it so they can type straight away without actually having to click inside the textfield. Previously in AS 2.0 you could use Selection.setFocus("textfield_txt"); but in AS3 is it possible?

Sorry if it's an easy question.

Thanks in advance.

Remove TextField Focus
Hi,

I have a movie that has four different input text fields, all in separate movieClips. Inside each movie clip I have code that listens for the 'Enter' key to be pressed, and if it is, it stores the value and turns the focus off of that textField...which works great.


Code:
txt.onKeyDown = function(){
if (Key.isDown(Key.ENTER) && eval(Selection.getFocus()) == this){
slider_mc.gotoAndStop(1);
Selection.setFocus(null);
}
}
My problem is that I want it so that if the focus is on one of the textFields, if they click anywhere outside any of the textFields, I want the cursor to disappear from the textField it was in, and all focus to be lost.

I tried doing this, by putting



Code:
Selection.setFocus(null);
on the root, but the cursor remains in the textField...which is weird since it worked in the onKeyDown function above.

Any ideas??

Thanks!
-b.

Kill Focus On A Textfield
Here's a tip I just figured out in regards to killing focus for a textfield:

Scenario:
- You have a form the user is filling out in your Flash site.
- They fill out half the form then go to another area of the site.
- The focus is still in the last textField they were entering information into.
- If there is other functionality that is not using form fields the focus stays on the last typed in textField.
- This can mess up other functionality events for the other movie clips in your site.

Solution:
Kill the current focus of the textField by setting the focus to a given movieClip:


ActionScript Code:
// enable focus for the clip
myMovieClip.focusEnabled = true;
 
// turn off that big fat ugly yellow highlight border
myMovieClip._focusrect = false;
 
// code to put inside your event function
Selection.setFocus(myMovieClip);


So in summary:
This code kills the focus on the given textfield and resumes normal functionality for your other interface stuff in your site.

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