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/
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 04-14-2006, 05:37 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Get The Selected Text Of A TextField
hi
can i get the text that the user select from the textfield
means i've a textfield i put some text in it then the user select a word for example i want to get this word
thank you for the help
[as 2][help] Make TextField Selected...?
like when you click on a textfield (say in an HTML form or whatever) and all the text is selected as you do so, so that you can click, then just type to replace what's there. can I do this with actionScript? I looked through the documentation and couldn't find anything that looked like it was setting the text to selected..
I know I can delete all the text on SetFocus, but I don't want to do that. This is for a crossword puzzle, and I don't want peeps to be deleting their entries just by clicking them.
TIA
Textfield Clear Text When Selected
I have a textfield with the text "type here" in it. I want it so that when the user clicks in it the text disappears.
The textfield uses an onChange listener to initiate a list filter function so I want to maintain this and add another function just to clear the text.
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!
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..
Drag/Drop Selected Text In TextField
This is a long shot, but is there a simple way to allow for the dragging and dropping of selected text in a text field?
For example, in a textfield if I were to highlight the last sentence, and drag it to the top so that it was the first sentence instead.
Thanks in advance for any help!
-Aaron
Detect If Text Is Selected In A Input Textfield
Hi,
I want to do a newspublishing tool and was thinking of making a simple WYSIWYG editor. User types text in a textfield, then user select the words to be bolded, press the bold-button and the textfield updates with the selected text bolded..
For starters I want to know if it's possible to detect if text is selected in a input textfield? And if somebody can point to further tutorials or reference Im most grateful.
regards /xaphod, sweden, using MX 2004
Links In An HTML Textfield Activate When Selected
Hi guys,
Any idea how to stop links in an input field working when you select them? I'm trying to build a WYSIWYG editor in MX, but the problem is, once you have created a link, you can't get rid of it because as soon as you select it the browser takes you to that url!
Hope someone can help....
Cheers,
Mark B
http://www.eclectica.nu
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??
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;
};
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
[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.
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?
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.
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?
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.
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.in_fo.onSetFocus = function(oldFocus){
this.autoSize = true;
};
When Row In Datagrid Pressed/selected, Set Textfield.text To Column[1] Value?
I have 2 textfields and a Datagrid
My textfields are called details.details.text and details.name.text
my Datagrid has 2 columns ('Name' and 'Details')
When i click on the Row in the Datagrid, i would like the two text fields.text to become the values of the Rows selected in the Datagrid
Do you know how i would do this?
How To Retrieve The Selected Text From TextField In Flash MX Using Actionscript
I need to be able to get the text selected by user after clicking a dynamic scrolling textfield.
I am very disappointed to find no method that returns the selected text when there is a property of textField to make it selectable.
I am using Flash MX. Let me know if this is possible in newer versions if not in MX.
Thanks
Edited: 04/27/2007 at 02:19:30 PM by dotnetuser
Dynamic TextField, Focus And TabIndex
.... Can a dynamic textField receive focus??? If so, how can I do it? I tried tabEnabled = true, but it's not working....
If a dynamic textField cannot receive focus, then how can I tab into an URL in a html textField?
Lil Help? Components, Textfield Selections, And Focus (oh My)
i may've backed myself into a corner, i think.
i'm working on a lite html editor.. i have an input and output/preview textarea: one's regular text, one's html. i'm loading an external stylesheet and throwing the styles into the combobox, and using the combobox elements' data to create span tags with the class set as the selected element's data value.
the only problem is, i'm having trouble figuring out how to keep track of selection focus, down in the input box. i have other buttons for inserting bold, italic, etc tags around the selection, and functions for setting the selection parameters to variables onRollOver for the buttons. it works nicely.. when a button's clicked, focus shifts back to the input field, the original text is selected, no problem.
with the combobox, however, i can't find any reference to a way to keep track of rollover?? is there some alternate way to set the selection parameters before focus on the input textField is lost? i tried adding a listener to combobox.open().. focus is already lost. is there a way to set the selection parameters upon selecting the text? i've looked around pretty thoroughly and can't seem to find anything that quite solves this problem. any info would be much appreciate, thanks
e:// whoops.. mx 2004
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
Textfield Select Text On Focus
Hi All
How do I select all text in a textinput textfield on focus? I thought it would be something like this, but I just can't seem to get it to work!
Code:
myTextField.addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
myTextField.alwaysShowSelection = true;
private function focusInHandler(e:FocusEvent):void
{
emailTextField.setSelection(0, 9);
}
Focus Problem And Textfield Scaling
Hey everybody,
This is my first post as an actionscript (3.0) noob
I've made an superclass for 4 MC's which should behave as buttons. Inside every mc is a textfield. When the mc is dynamically resized the textfield grows too. I don't want these textfields to grow! How can I solve this?
Second, I want only the mc's going to deactive state when one of the other mc's is active. What's the best solution?
This is my external AS-script.
ActionScript Code:
package net.myradon.navigation {
import caurina.transitions.Tweener;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.FocusEvent;
public class NavButton extends MovieClip {
//Constanten
public static const MOVE_Y = 10;
public static const ROTATE_MC = 15;
public static const SCALE_MC = 1.15;
//Constructor met events
public function NavButton():void {
this.addEventListener(MouseEvent.CLICK, clickButton);
this.addEventListener(MouseEvent.MOUSE_DOWN, rotateForward);
this.addEventListener(FocusEvent.FOCUS_OUT, rotateBackward); //functie rotateBackward wanneer andere mc focust
this.addEventListener(MouseEvent.MOUSE_OVER, moveButtonUp);
this.addEventListener(MouseEvent.MOUSE_OUT, moveButtonDown);
this.buttonMode = true; //MC gedraagt zich als button
this.mouseChildren = false; //Childs van MovieClip hebben geen invloed op interactie met MC.
}
//Wanneer met de muis de MovieClip wordt aangeklikt zal er nu nog niets gebeuren.
private function clickButton(e:MouseEvent):void {
trace("de button " + this + "is aangeklikt");
}
//Wanneer de muis een andere MovieClip focust dan zal funtie worden uitgevoerd.
private function rotateBackward(e:FocusEvent):void {
//trace("de muisbutton is losgelaten op " + this + " en zal mc terugschalen");
Tweener.addTween(this, {scaleX:1, scaleY:1, rotation:0, time:1, transition:"easeOutExpo"});
}
//Wanneer de muis op de MovieClip wordt ingedrukt zal Tweener class een transitie stilzetten.
// en de mc zal worden geschaald.
private function rotateForward(e:MouseEvent):void {
//trace("de muisbutton is op " + this + " ingedrukt, tween wordt gepauzeerd en mc roteert+schaalt");
Tweener.pauseTweens(this);
Tweener.addTween(this, {scaleX:SCALE_MC, scaleY:SCALE_MC, rotation:ROTATE_MC, time:0.5, transition:"easeOutBounce"});
}
//Wanneer de muis over de MovieClip gaat zal Tweener class een transitie afhandelen.
private function moveButtonUp(e:MouseEvent):void {
//trace("de muisbutton " + this + "is binnen MC");
Tweener.addTween(this, {y:-MOVE_Y, time:1, transition:"easeOutBack"});
}
//Wanneer de muis buiten de MovieClip gaat zal Tweener class een transitie afhandelen.
private function moveButtonDown(e:MouseEvent):void {
//trace("de muisbutton " + this + "is nu buiten MC");
Tweener.addTween(this, {y:MOVE_Y, time:1, transition:"easeInBack"});
}
}
}
comments are in dutch so....
If there're other recommendations concerning this code don't hesitate! Is this superclass the best practice for same button behaviour? (All the button mc's are in a navigation_mc which is on stage)
this AS3-testcase project: http://www.myradon.net/testcase
By the way, the button mc's and textfields all have different instance names. Is this practical because of the superclass? How do I differentiate between different instance names even "this" reffers to different instance.
I'm getting a headache from reading AS3 essential and FLCS3 Advanced
Chk If Stage.focus Is A TextField Object
I have a stage with many objects.
At a certain pt of time. if i need to know if the current stage.focus is focusing on a TextField. how do i check?
as in I do not want to write sth like
if(stage.focus == TextField1)...
bcoz there are variable number of text fields. I want sth like
if(stage.focus is a type of textfield)
how do i go abt it? thanks!
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);
Focus On A TextField ..doesn't Work?
Why is it not possible to do an setSelection on a textfield in Actionscript 3.0?
If you draw a dynamic textfield and call it's idintifier samle_txt and i would place these
lines of codes:
sample_txt.text ="Hello World";
sample_txt.setSelection(2,4);
It should work? or what about the setFocus? that does not work too.
Anybody got an idea why it does'nt not work ?
Setting TextField Focus BorderColor
This is frustrating me beyond belief.
How can I write a function that checks to see if a text box is in focus, and if it is, turn the border color to red... if not, turn it to grey?
PLEASE!
|