ActionScript 3.0 :: Focus - Click On The Playscreen For It To Accept Keyboard Input
Dec 1, 2010i click on the play button and go to my playscreen. Then I have to click on the playscreen for it to accept keyboard input!
View 11 Repliesi click on the play button and go to my playscreen. Then I have to click on the playscreen for it to accept keyboard input!
View 11 Repliesfound only one thing that seemed to be on the lines of what I am having issues with:
stage.focus = this;
My problem: The the flash app I am working on, some of the controls are done with the keyboard. At certain points, you need to click on an on screen button to continue. When I do this, it seems the focus is lost from where it was, and I can no long use keyboard actions (such as the spacebar KeyboardEvent that works prior to clicking the mouse)
I will admit that I am a newcomer to Flash (only played with it for about a month now), and I don't know much about the focus stuff. Basically, I want to know how to set the focus back to where it was after the buttons are clicked.
So i have a combo box that a user can go a select different UI's with. In another pane i have a map that the user can press the arrow keys the move up, down, left right etc.
Only problem is that once i have selected a map from the combo box, the combo box stays in focus so that when i press an arrow key, the map moves but it also scrolls through my combo box.
Any way i can disable keyboard input to the combo box or remove the focus on the combo box?
I've tried creating a dummy button on the stage called "dummy" and when the change event happens on the combo box i switch the focus using
Selection.setFocus("dummy");
but then i get a recursion error and it stops my scripts.
When using a notebook and I have remarked that I cannot enter numerical character with shift + a letter to enter number.Is this a bug in flash ? How to circumvent this ?
View 2 RepliesI'd like to set up my splash page (all Flash) so that the login form is ready and waiting for input, without the user having to move the pointer to the first input text field and then click it.
View 3 RepliesUsing AS3 to create a basic number guessing game but for some reason the input text field won't accept text input. I can't figure out which piece of code is causing the problem and it's driving me nuts considering it's from a tutorial.
Code:
package
{
import flash.display.MovieClip;
[code]....
can I set the keyboard focus for a TLFTextField? I tried stage.focus = myTLF but there is no cursor...
View 2 RepliesIf I plan to implement 100 objects on stage to be listen to mouse and keyboard input, is using "function" call responsive enough? How good does eventlistner work?
View 2 RepliesI have an input text TextField in my movieclip instance but the text field just won't accept all my characters. I can enter for example character 'e', but pressing for example key 'p' won't work. Movie clip and it's TextField child is created in flash editor but I am creating an instance of this MC in my AS3 document class.If I set keyboard event handler, it catches all the keyboard events, but the are just not shown in InputText field? I am using default Arial and Helvetica fonts.
View 1 Replies[Code]...
when i have this line active(the red one) it gives me automatic focus, so no clicking to be able to detect key input so i got that going for me which is nice BUT when i have it active(not commented out) i get this big yellow line which goes away when i click it(seeBelow)
I have a TextField called textField on the first frame of the main timeline, and this simple code.
Code:
import flash.events.KeyboardEvent;
import flash.events.FocusEvent;
[code]......
I'm having a weird problem with AS3/CS5: I have a textfield, and I'm playing around with focusing on it at various points. At one point,I set focus to the textfield (which only accepts 1 character), then add an Event.CHANGE listener to it. This works fine, except when I type the letter 'a' (or 'A'). Nothing happens until I click on the text field and type 'a.' I don't have to do the second click with any other character, and before I do the second click, the cursor is blinking in the box. Not sure what to do...
[Code]...
I have written a jquery/javascript editor in FLEX 3 and actionscript 3. It has syntax checking facility. I will write a syntax checking parser either in C or in java. Here, I will include executable file only with flex code. That executable file should accept fully qualified file name as input parameter and it produce compilation result as output, that i need to display in flex.
Please anybody provide suitable solution that how to add executable file in flex, that will accept input parameter and produce output.
I'm writing an application using a DataGrid DG1 in a MovieClip MC1. The User can click on DG1 and edit it, ok, no problem. But when the User begins to edit the content of a specific cell of DG1, I want to open a dedicated wizard in front of it. In the first step of that wizard popup (MovieClip MC2, child of MC1), there is another DataGrid (DG2) and I would like the User to be able to directly use the up and down keyboard arrows to browse the DG2 content without having to click it first.
But the keyboard events are then captured by DG1. I tried to use a stage.focus, setFocus, I triggered MouseEvents on DG2 but nothing to do, I have to physically click on it before the keyboard events are sent to it. So, my question is: how to, within MC1, tell Flash the keyboard events will be triggered on DG2 ? Can we ask DG1 to loose the (keyboard) focus ?
There are 5 movieclips on the stage (btn0 to btn4). I wanted to change focus pressing Keyboard.UP and Keyboard.DOWN. But the focus changes not in correct order. It jumps in mysterious way from 0 to 2 and so on.[code]
View 6 RepliesI have a custom TitleWindow component that is registered to listen for keyboard events from the user (so that esc closes the window, enter saves, etc.). However, in my testing I've found a couple cases where my keyboard event handlers don't fire. My best guess as to why this is happening is that there is some child component somewhere that has stolen focus and is stopping the keyboard events from propagating.
Unfortunately, due to the large number of components in my TitleWindow, I have no good way of knowing who has stolen the focus. My question then is, are there any good tips / techniques / tools for debugging focus issues and event propagation in Flex? Basically, I need something that will tell me who has the focus at any given time and who's handling an event at any given time... is that possible?
What would be the appropriate way to add some AS in a flex-project, giving giving focus back to the parent browser.
ctrl-q: i'm blurring flash
ctrl-t: ah, a new browser tab.
Anyway, I have a game with keyboard input and mouse input, and after certain mouse inputs I want to set the focus back to the stage in order to continue listening for keyboard events. I have a simple method in the document class:
Code:
private function setCommandLineFocus( e:MouseEvent=null ):void
{
if( theCommandLine )[code]....
Where "theCommandLine" is a movieclip which gets attached, and is where I send the keyboard events to.
The problem I'm having is this: When the method gets called in internet explorer, it sets the keyboard focus to the URL bar, so you type stuff in, and then hit enter and it reloads the damn page.
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 = "";
}
[code]....
I'm trying to give focus to a text input with instance name "input" so that when I run the movie, there is a blinking cursor where the input is so that the user has some visual cues. I also changed the background and made it only accept numbers. This code is in an init() method, which is run from the constructor
input.backgroundColor = 0xFFCCCCCC;
input.restrict = "0-9";
stage.focus = input;
The first two lines of this work fine, the background is grey and it only accepts numbers as expected, however the third line doesn't work. The input text is not given the focus. Once I click on the input text then I can see the blinking cursor. I also tried this.stage.focus=input;, but that didn't work either.
Apparently when a swf is loaded, the application does not have immediate focus. Even if the code
stage.focus = myInputBox
is in the constructor, the user must tab or click the inputbox to obtain focus.
I have a swf that is having problems only when I load a movie.[code]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".[code]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.
View 6 Repliesi have a problem when my site loads in the next section i want that section to have focus on input_txt.text
it works everywhere but this one textbox
i normally use stage.focus.(instance name)
but that doesnt work when loading a part in
I got a text-InputField:
var textfield:TextField = new TextField();
textfield.text = "";
textfield.type = TextFieldType.INPUT;
addChild(textfield);
because this textfield don't reside in the main-class, I don't have a stage-reference for doing:
textfield.stage.focus = textfield;
or
stage.focus = textfield
How can I force the textfield to display the blinking line at position zero?
I have two text input boxes p1 and p2. I want to do a conditional test to see if p1 has the focus. If it does not, then p2 must have the focus. Here is some code I am trying to get to work.
if ((Selection.getFocus()) == (p1totalScore.text)){
p1Score();
} p2Score();
[code].....
i have one input text Field in Login screen in which i want to set default focus. for this purpose i use stage.focus = textFiled, its working fine when i run swf into Flash IDE but when swf integrate with java (in Jar file format) on other word when i run java environment, default focus is not set on input textFiled. when i click on textField its working fine.
View 0 RepliesOn 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.
View 3 RepliesHow to remove focus from 1. The input field if the user clicks outside the input field.
View 1 RepliesWhen I put focus on input text, I get Error #1023.
mc.tabChildren = true;
mc.tabEnabled = true;
mc.getInputTxt().tabIndex = 0
mc.addEventListener(FocusEvent.FOCUS_IN,updateFocus);
private function updateFocus(e:FocusEvent):void{
stage.focus = e.currentTarget.getInputTxt()
}
I want textfield to be in focus with blinking cursor when the page loads.This doesn't work - not in Flash IDE not in browser[code]...
View 0 Replies