Flex :: How Does Focus Works

Feb 17, 2011

I try to figure out how does focus mechanism work in Flex. Here comes the example of what I mean:Let's assume that we have a simple web application, which contains custom component that extends Canvas and implements mx.managers.IFocusManagerComponent. This component overrides focusInHandler and focusOutHandler methods and shows some feedback on how they are called (thinner or thicker border). This custom component also contains some Text.[code]

If you click once on a violet canvas it receives focus (focusInHandler is called), then if you click again the focus is lost (focusOutHandler called) - why?Of you click on a Text the Canvas receives focus (focusInHandler called) and keeps it when being clicked wherever on the area (focusOutHandler nevet called) - why?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: What The Focus 2 - Automatic-focus - Clicking To Be Able To Detect Key Input

Mar 8, 2011

[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)

View 1 Replies

ActionScript 3.0 :: Finding Out When A TextField Has Focus And When It Loses Focus?

Jul 13, 2009

Does anyone know how to do this in AS3?

View 3 Replies

ActionScript 3.0 :: TLF Focus - Set The Keyboard Focus For A TLFTextField And Cursor?

Sep 14, 2010

can I set the keyboard focus for a TLFTextField? I tried stage.focus = myTLF but there is no cursor...

View 2 Replies

Flex :: Make Flex Grab The Focus Of The Mousewheel?

Aug 7, 2009

The entire box at the top is a Flex application. The box on the left with the list of pinball machines is a VBox. As you can see, if you try to scroll with your mousewheel, it doesnt respond. The reason this is shut off is because I found that if it's turned on, when you scroll up/down, the whole page goes with it. So if you scroll down four or five times, the application goes out of sight.I tried finding a solution to this when I programmed this last year but wasnt able to find any answers.if there's a way to make Flex grab the focus of the mousewheel and not let the browser move as well?

View 4 Replies

Flex :: New Grid Row With Focus?

May 26, 2011

I am trying to make an editable DataGrid to insert a new row when user presses TAB in the last column of last row.y Grid:

<mx:DataGrid id="myGrid"
dataProvider="{initDG}" editable="true"
itemFocusOut="onItemFocusOut(event)">

[code]....

View 2 Replies

Flex - Unable To Get Focus On Canvas?

Dec 13, 2009

I am creating a canvas in actionscript like :

private var cvs_preview:Canvas = null;

[Code]....

So on the focus change i want to run the "end_preview_on_focus_change()" but this is not working. As per my understanding, i think the canvas not getting any focus in the first place. I was trying to use focusManager.setFocus to do that after the canvas's creation complete. but even that is giving me an error.

[Code]...

View 3 Replies

Flex :: Set Focus And Selection On A TextField?

Jan 16, 2011

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:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="_init()">
<mx:Button click="{tf.setSelection(1,2)}" />[code]....

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,

View 2 Replies

Flex :: Set Focus On UI Control, Button, Etc?

Feb 8, 2011

I'm trying to set focus on a specific button when the app launches (or later based on certain events), so that the user can simply hit return to press the button. None of the following approaches work however.

protected function group1_creationCompleteHandler(event:FlexEvent):void
{
//btnBrowse.setFocus();
focusManager.setFocus(btnBrowse);
}

View 3 Replies

Flex :: Focus Border For DateField

Mar 31, 2011

Is there a way to Set a a focus border on a datefield when it is selected and change the border to some other colour when we lose focus from the datefield.

View 1 Replies

Flex - Cannot Focus Children Of SkinnableContainer?

May 25, 2011

I have a custom component extends from skinnableContainer and only has two NumericSteppers.I explicitly set focus to my component like myComponent.setFocus(). It sets focus to first stepper which is correct, but when I press TAB to move focus to next stepper it moves focus to the next Component.

I set tabEnabled = true and tabChildren=true of the component, still no luck. How could I set focus to next stepper on pressing TAB?

View 1 Replies

Flex :: Focus - Getting FocusedIndex In A Buttonbar?

Nov 7, 2011

I've been looking around on how to get the focusedIndex property of a ButtonBar when there's a mouseOver/Out event, but haven't found nothing useful.EDIT 1Assuming we have this button bar:I'd like to know, when rolling over, the target button.Putting a break point in a function that listens to the mouseover event, this is what I see in the debug view:

View 1 Replies

ActionScript 3.0 :: Keyboard Focus Not The Same As Focus?

Mar 16, 2009

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]......

View 2 Replies

Flex :: AIR Set Focus On Textinput On Application Load?

Dec 22, 2009

On my application I have a login form. On application start, I want the focus/selected one is set on the user id textinput. I tried normal setFocus method and didnt worked. How can i make it work?

View 1 Replies

Flex :: Trigger Mouseevent When The Focus Is On TextInput?

Jul 29, 2010

In flex, I am using the following:

mx:TextInput mouseOver="tester(event)"

It works fine. My pointer goes over the textInput and it calls the function. But when I click inside the textInput to enter some text( focus is on the textInput) and then move the mouse (not taking mouse pointer outside of the boundary of textinput), the mouseover event is not trigerred.

If I use click event, then even if I am entering text ( or the focus is on the textinput) and then click, it will call the function.

How can I call the tester function on mouseover when the focus is on textInput?

View 1 Replies

Flex :: Using Tab Focus Manager In A Title Window?

Sep 7, 2010

I'm struggling to get around an error that is constantly thrown in my application when I press the tab key.

I have a modal dialog box that contains a form with 3 form items. Whenever I press the tab button flex throws an error saying

"ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller."

I've tried setting up a focus manager in the initilize handler of my title window to no avail

private function init(e:FlexEvent):void
{
focus=new FocusManager(myform);
focus.setFocus(firsttextfield);

[Code]....

View 2 Replies

Flex 3 - No Blue Focus Ring On Button?

Nov 3, 2010

My button doesn't have a blue focus ring around it, even though it has focus. I've got a component with a RadioButtonGroup and a Button. After a selection is made in the RadioButtonGroup, focus is switched to the Button. I added click="focusManager.setFocus(myCloseButton)" on the VBox.

After, a radioButton is selected, if the user clicks the spacebar the Button fires. So, as I understand it focus was switched to the button. But, the button doesn't get a blue focus ring surrounding it. How do I get the focus ring? I have visible="false". I turn them to visible, after some effects are finished. So, don't let that throw you.)

[code]...

View 1 Replies

Flex :: Set The DG In Focus From Stage KeyDown Handler?

Feb 25, 2011

My app has a datagrid as well as many other UIComponents (buttons, menus, etc). I have a general stage KeyDown handler as well as a specific one for the datagrid. The behavior I'm trying to implement is turning out to be trickier than I thought: basically, when using the keyboard arrows I would like the datagrid to always hear about such commands, even if it's not in focus.

Possible approaches I thought of:have the DG be in focus at all times: seems stupid / tricky - basically would need to remember to give focus back to DG after any interaction with the rest of the UI, which obviously doesn't scale.try to set the DG in focus from stage KeyDown handler: seems like the timing doesn't work since the DG gets focus too late to "hear" the event.from the stage keydown handler, check if the DG is not in focus, and if so pass it the event. This seems to make sense in theory, but I'm not sure how to do this properly since my stage keyDown handler uses capture, and thus seems to catch the same event over and over.

View 1 Replies

Flex :: Force Component To Redraw It's Focus?

Mar 23, 2011

Suppose I have a component and want to change it's focus color at runtime. Here's an example for you (I've excluded any buttons and such to prevent component from losing it's focus, cause in that case it changes it's color perfectly):

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()">
<mx:Script><![CDATA[
private function init():void {

[Code].....

What do I want: How to make this focus to be redrawn without magic (I've tried all the methods, starting with "validate", I've tried calling updateDisplayList() on entire application, I've tried to call styleChanged .

View 1 Replies

Flex :: Keep Item Editor While The Focus Is On The Layer

Jul 19, 2011

I am using a combo-box as a Datagrid ItemEditor (Not just Renderer, my Renderer is a Label, double clicking on a cell makes the combo-box visible, as is the case with all item editors) Now, selecting one of the entries in the combo-box is no problem. But my problem is only when i select the "Fruit", which in turn pops open another layer called "Select Fruit" dialog

Questions: How do i keep item editor, while the focus is on the layer; right now as soon as i click on the fruit, my handler popsup the "Select Fruit" dialog and the focus is on the layer. Once the focus goes out of the editor, the ItemEditor goes away and ItemRenderer label comes back. I want to keep the ItemEditor alive! where do I hook up interms of events like begin/end ItemEdit etc?

View 1 Replies

Flash - Flex 4 Focus Multiple UIComponents?

Aug 24, 2011

I'm currently coding a Floorplan editor with Flex 4.I have a Floorplan Grid that extends the spark Group class. This Floorplan Grid will contain objects that extend the UIComponent class. I want the user to be able to select multiple objects on the Floorplan and be able for moving and resizing.

I'm just wondering if it's possible to have multiple objects being "focused" using the FocusManager, kind of like selecting multiple objects in Photoshop /Illustrator.

View 1 Replies

Flex :: Ignore Mouse Focus On Tool-tip?

Sep 27, 2011

I've created something that works like a ToolTip in my Flex application. When I roll over a certain item renderer, I pop up a new control, position it, and remove it on roll out. The order of operations is like this:

Roll over event handler triggered. Add the tooltip to this.systemManager.topLevelSystemManager.toolTipChildren. On creation complete of my tooltip, set x, set y coordinates of the tooltip (on creation complete so the width and height are calculated since they are dynamic). Roll out event handler triggered. Remove tooltip.

This worked fine when I set the x and y coordinates to be x+10, y+10 from the current mouse position. I wanted to add something that re-positioned the tool-tip if it was going to be drawn partially off screen. I added a step that would calculate if it would be drawn off screen, and re-position the tooltip if it was going to be cut off.

The problem with my solution seems to be that it now runs in an infinite loop of redraws, since adding the tool-tip to the screen underneath the mouse triggers the "rollOut" on the item renderer. This triggers the removal of the tooltip, and starts the process over again from 1.

is there any way to ignore tooltip so it doesn't take the mouse focus away from the item renderer that is now under it?

View 3 Replies

Flex :: Set Focus On One Component Until User Enters Some Value

Oct 3, 2011

I am trying to write the code for making a text input control in flex. As the user enters the value in text input control and then if he removes the typed characters to make the text input blank, then I print error message via StringValidator. But I want the focus to be set on that text input only until the user enters anything. How can I achieve that?

View 2 Replies

Flex :: When Object Has Focus Highlight Parent Instead?

May 27, 2009

I have a TextInput and a Canvas object both inside an HBox object. When the input text field has focus it highlights, I would like to change this to be the containing HBox that highlights when the Input Text has focus.Does anyone have any ideas on how I can do that?Here is my code:

<mx:HBox
keyDown="checkKey(event)"
horizontalGap="0">

[code]........

View 1 Replies

Flex :: Prevent Highlight On Object With Focus?

May 27, 2009

I have a TextInput object that highlights when it is focused...I would like it not to highlight when it is focused. way to stop it?

View 2 Replies

Flex :: Have A Button Not Fire On Space Key If It Has Focus?

Jun 11, 2009

The behavior I'm trying to prevent is after a user clicks on a button, the button retains focus, and then if the user hits the space key, the button fires again. So I thought it could be solved either by setting the focus elsewhere, or by having the button ignore the space key. I've tried adding the following keyDown event listener on the button, but it didn't work.

private function btn_keyDown(event:KeyboardEvent):void {
// try to ignore spaces, i.e. don't click on SPACE when it has focus
if (event.keyCode == Keyboard.SPACE) {
}
}

I tried changing focus by doing the following, at the end of the function that's called when the button is clicked:

stage.focus = parent;

View 5 Replies

Flex :: Programmatically Set Focus To HorizontalList So That It Could Receive Key Events?

Oct 26, 2009

look at the code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:creationComplete>

[Code]....

As you see, I try to make my HorizontalList focused when application is loaded. And I actually receive Received focus message in console. But I expected that I would be able to navigate over list elements with arrow keys after setting focus. But that's not the case. They work only after clicking component with mouse. How to make list have focus and respond to arrow keys?

View 2 Replies

Flex :: Debugging Focus And Keyboard Event Propagation In AS3

Dec 18, 2009

I 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?

View 1 Replies

Flex :: Update The Model Without Losing Focus In Datagrid?

Jan 25, 2010

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 :

myModel.focusedCell.rowIndex = e.rowIndex;
myModel.focusedCell.columnIndex = e.columnIndex;

But, from where restore these parameters ? How to trigger this update only when the model is updated ?

View 1 Replies

Flex :: Setting Focus On A Popup's TextInput Control?

Jul 27, 2010

I'm trying to have a popup window with an immediately editable TextInput. This means that the user should be able to type inside the TextInput once the popup is displayed.

The problem is that I can't focus on the textInput. What happens is that when pressing a key for the first time, no text is inserted, only after a second key is pressed does the component gain focus and the user is able to type. For instance, typing "test" once the popup opened results in "est" being displayed...

For some reason the component only gains focus when the user explicitly clicks on it or types something. Programmaticaly setting the focus does not work.

Code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns="mog.miss.component.*" xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>

[Code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved