ActionScript 3.0 :: Prevent TextField From Losing Focus?
Dec 4, 2010
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?
I've hit a very strange issue in adobe flex and I'm not sure how to solve it. I have a popup box that is called on creationComplete before startup of my main application. The popup simply asks for an email address and then the application is enabled showing the email address in a label component.
However, when I try to access the email address from the label component called UserID.text in the application, it is always null even though it is visually present in the label box...It seems like it loses state somehow...so HOW in earth can I keep it from losing state? I need to access the label or some variable throughout the use of the application and everything I try always ends up in a null variable?The main part of the application that sets the label is here:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:controls="com.iwobanas.controls.*" xmlns:local="*" creationComplete="showWindow(true)"> private function showWindow(modal:Boolean):void
I built this incredibly brilliant scrolling thumbnail image viewer for a client in flash actionscript 3. (Basically it just scrolls up or down depending on the mouse position). It works so so, (I can never get the percentages right so that it shows the top most image) but, that's beside the point. What is REALLY irking me is when I have the browser window open with my .swf loaded and I click on another app on my desktop, the stupid scrolling thumbnail area in the browser window starts to freak out.
"Where is my mouseY?" I assume it is thinking.
Is there a stage.Unfocus event I can tell my scrolling thumbnail area to STFU with?
I'd even consider writing some javascript to call a flash function, if that's a preferred technique.
function checkMousePos(e:Event):void { if(mouseX < 145){ try{
Does anyone know if there's a workaround to the fact that when you escape fullscreen mode in a browser, the swf seems to lose focus? I'm doing fullscreen video and I have to press the pause button twice when returning from fullscreen. I noticed the same problem with YouTube videos.
I have a class listening for key presses attached to the stage, works fine until...a menu item that when clicked removes the menu from the display list. This seems to cause the stage to lose focus & I need to click the mouse on the SWF to get the keys to register again.
In my Flex Project using Cairngorm, I have a model that stores a bindable ArrayCollection displayed by a DataGrid. My problem occurs when the model is updated by the responder (from a Java service, after an "update" event), because the focus located in a cell of the DataGrid is lost (the scroll position il also lost). So, I retrieve the position before the update, with DataGridEvent.ITEM_FOCUS_IN event :
If I have a prompt window where I am asking the user for some input, is there some way I can prevent them from switching window focus to the other windows in my application? (switching to other applications is fine) I'd actually have preferred if the window didn't appear in the taskbar at all, but utility windows look awful and I'm using system chrome so lightweight is out.
I just recently started playing with cs5 and it's new features. I tried to rotate a textfield with the 3D rotation tool, but when you do this, the textfields gets blurry.And it seems like it's not a vector text anymore, because when you zoom in, it still is blurry.Is there a way to prevent that?
I have a web page where users can play flash games. We are now making some changes to the page which requires the games to be embedded with wmode=transparent or wmode=opaque so that we can show HTML elements on-top of the flash games. The problem is that in Internet Explorer (on all versions) the whole page scrolls if a user presses the up/down arrow keys. I've tried everything I can think of and I've spent a whole day searching for a solution without success.o far I've tried putting the game inside a iframe and I tried disabling the up/down keys with JS, none of which solves my problem.
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"?
When i made a textfield and i specified the font size 10 points and choosen a font and than later resize the textfield to the size i want and i than type in text, he scales the text size. The properties window says its still 10 points but it is not.
How can i make a textfield the size that i want without losing my textsize settings ?
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.
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,
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 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).