I am trying to programmatically pass focus to a newly created TextField, but for some reason setSelection and setFocus do not work. For example, see my test code below:
The only setSelection that does anything is the 0,3 one on MOUSE_DOWN. I assume this all has something to do with the text field receiving focus with the mouse click,
I have a web page which has a SWF file embeded. I have an issue with the focus.
Steps to reproduce:
1)Click on a HTML Text Field which is inside a Iframe
2)Click on a Flex Field.
3)Begin to type some text.
Expected Result is the entered text should go in the Flex TextInput field but the actual Result is it goes into HTML text field.
This is the bug which was filed but closed without any resolution. The workaround suggested there doesnt work. ( bugs.adobe.com/jira/browse/SDK-12377 )
This is happening only in IE 6.0 and IE 7.0. Below is the live example. [URL]
I have a numerical stepper,and a user can click on a textfield, then click the up and down arrows on the stepper to change the font size,i then try and set the focus back to the textfield and put the caret at the end of the textfield, but the stepper keeps focus anyway.Here is the event handler for when the stepper value is changed.Get the textfield's current format, change the size, set the new format, then focus on the textfield and set the caret position, but the caret just stays inside the stepper.
Code: private function handleChangeTextSize(e:Event):void { var tField:TextField = Main.LAST_FOCUSED_OBJECT;[code]....
I've had problems with other components too with the exact same focus issue and the only solution i've ever come up with is to set a timeout for like 100 milliseconds to set the focus back then and it works. another way to do this without the "hack"?
I don't really know what I'm doing I'm completely gone in my own code, I think I'm going around in circles!
[Code]...
Ok let me explain what I want to do: when my movie loads I want "textfield" to be focused, so I use Selection.setFocus(textfield); Fine! But on a frame before this I have a button to enter my site! Now as soon as you click this button it changes the focus so that when I enter the frame with the textfield it is no longer focused! Make sense? Well on this frame once the textfield is focused you can enter text right away! and then I have this listener which listens to an event within the textfield! Ok now I'm even more confused then when I started explaining this! Anyway I want the textfield to be focused when you enter this frame and if the user focuses something else, well then they will have to focus the textfield themselves. Basicly I just want the the textfield to be focused on load, but the problem is my button at the start! What?
I am trying to use setSelection on a TextField in an air 2.7 for ios app. But the selection is not set and the keyboard does not appear. I understand that the 2.7 version encourages using the requestSoftKeyboard but this method is not supported on ios devices.
How can I change the select ("highlight") color of an TextField in actionscript 3? I've got an input textfield with white text on a black backdrop and as a result, selections are invisible, which is horrible for usability.
I have this textfield with multiline behavior and the problem is that when i select my text and then drag the selection down all the way to the bottom the text seems to scroll.
Now that setFocus() is gone, how do you tell the player to set focus to a specific input text field. I've searched thru the reference docs and haven't had any luck.
i have made a flash movie which is working perfectly. I used the tutorial by GotoAndLearn which you can find here...[URL]... which shows how to make a preloader as a separate swf file and he states that you won't need to worry about the swf file that is loaded by the preloader.
He was correct for everything in my movie except for the
Code:stage.focus = null; code which i use to move the focus away from a textfield once a person has entered text and hit the Enter key. Basically, i just don't want the typing cursor to hang around after the user hits enter.
I had a question regarding the 'passing' of focus. I have a class (more like a component) which contains a TextField.If I give 'focus' to the class, how can I send the focus to the TextField (which is private to the class containing it, like a component).To elaborate, I'm not sure focus occurs on 'just the endpoint' or 'to a branch'.If focus is just given to the endpoint, how does my component disregard having focus and gives the focus to the endpoint?If focus is a given to a branch, what if focus is given (via mouse click) to the text field? I would have an event listener catch the focus event which shares the focus with the parent, but the problem there is once the parent has focus it shares the focus with the child which creates a loop.
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?
I am new to AS3 and trying to figure out how to set a focus to a textfield on the stage. I found out that if I use stage.focus = tf; then the tf get the focus and it does, when I type letters they go directly to this textfield.Problems are, I don't have a blinking cursor in the textfield. I added event listener to catch up when the user press the ENTER key but it catches the ENTER key ONLY after I click the textfield with the mouse and having a blinking cursor in that textfield.
In as2, I have a button that attaches a movieclip with inside some input text fields (a mail form). Now, as the tweening ends for the movieclip to actually appear (I set the _alpha to 0 as he's been created and change the value to 100 with a tween), I call a function for setting the focus on the first input text field:
Code: function setTheFocus(){ Selection.setFocus(_root.mailtext.namex); trace(Selection.getFocus()) }
Where 'namex' is the istance name of the input text field. The getFocus trace returns positive, so the focus is there but ... there is no flashing bar within the field. If I write something, the text appears in the right text field and the flashing bar appears. I can't get why there is no flashing bar without typing anything, even if the focus is set.
What I basically want to do is create a Textfield that takes user input, even if they have clicked somewhere else on the screen.As I understand it, clicking on another object will cause the Textfield to lose focus and no longer take input. Is there a way around this?
I'm drawing a textfield onto a bitmap which I use as texture for a 3D object. I'm listening for Event.change, and so whenever the user adds a character I redraw the texture. But to really give the 3D object a 'interactive textfield feeling', I want to draw text selections and draw the caret (the blinking text cursor), but by default these a not drawn when using bitmapData.draw(textField), nor can I find a Event to listen for 'textSelected'.
//is there any event that catches text selection / blinking of text-cursor? textField.addEventListener(Event.CHANGE, redrawTexture); //... //is there any way to draw text selection / text-cursor in the bitmap? bmpData.draw(textField);
I have an input textfield (input_txt) inside a movieclip (mc), how do i clear the focus (blinking cursor)? I want to place this code on the root timeline.
I have a problem with setting focus on a textfield in a child movieclip from my DocumentClass.
I have a function in my DocumentClass that try to set focus on a textfield in a child movieclip:
private function setFocusOnUserName():void { this._mc._txUser.stage.focus = this._mc._txUser; }
But I get that stage is null.
And I get error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.ro.main::DocumentClass/setFocusOnUserName() at com.ro.main::DocumentClass()
Is it possible to override the default focus event on the in-built TextField class? So for example when a textfield gains focus a custom event is triggered rather than the default one? I know we can use the onSetFocus event, however we have over 1200 swfs that use TextFields so want to do it on a global scope rather than having to modify each individual swf. that on an Android tablet selecting a TextField brings up the android keyboard that not only shrinks the flash content, but defaults to the alpha keyboard when all we want is numeric (it's a Maths app).
i have a button that clears the entire TextField but clicking the button makes me lose focus from the TextField. Right now I'm just putting the focus back with stage.focus = textField; as the event occurs.
Is it possible to somehow not lose focus from a TextField when pressing a button?
On my stage I have an MC with a textfield of type input. I have another MC on stage with the control for the input like bold, and italic. When my textfield has focus and I click on one of the control MC buttons it loses focus. I know I can reset focus with stage.focus but wanted to know if there is a better way. Like disable the control MC from taking the focus off the input text. I thought this was not the behavior. I thought that only another input type control can steal focus until now.
Is it possible to override the default focus event on the in-built TextField class? So for example when a textfield gains focus a custom event is triggered rather than the default one? I know we can use the onSetFocus event, however we have over 1200 swfs that use TextFields so want to do it on a global scope rather than having to modify each individual swf.
The idea is that on an Android tablet selecting a TextField brings up the android keyboard that not only shrinks the flash content, but defaults to the alpha keyboard when all we want is numeric (it's a Maths app).