focusManager.deactivate() not working correctly

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

focusManager.deactivate() not working correctly

pol2095
This post was updated on .
Hello,

when I use focusManager.deactivate() and I put on tab key, the component
is not highlighted but the focus change ?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"	
	xmlns:s="library://ns.adobe.com/flex/spark"
	addedToStage="addedToStageHandler(event)">

	<fx:Script>
		<![CDATA[
			private function addedToStageHandler(event:Event):void
			{
				focusManager.deactivate();
				stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
			}
			private function onKeyDown(event:KeyboardEvent):void
			{
				if( event.keyCode == Keyboard.TAB )
				{
					trace( stage.focus );
				}
			}
		]]>
	</fx:Script>

	<s:VGroup>
		<s:Button label="button"/>
		<s:Button label="test"/>
	</s:VGroup>

</s:Application>

Thanks



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: focusManager.deactivate(); not working correctly

Alex Harui-2
I don't think you should be using focusManager.deactivate() in your application code.  What is your goal?  Prevent tabbing to a component?  I think you are supposed to set tabIndex=-1 instead.

HTH,
-Alex

´╗┐On 1/26/20, 10:07 AM, "pol2095" <[hidden email]> wrote:

    Hello,
   
    when I use /focusManager.deactivate();/ and I put on tab key, the component
    is not highlighted but the focus change ?
   
    /stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
   
    private function onKeyDown(event:KeyboardEvent):void
    {
    if( event.keyCode == Keyboard.TAB )
    {
    trace( stage.focus );
    }
    }/
   
    Thanks
   
   
   
    --
    Sent from: https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-flex-users.2333346.n4.nabble.com%2F&amp;data=02%7C01%7Caharui%40adobe.com%7Ca16d1920c7a944a3428e08d7a28aa2f2%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637156588631161912&amp;sdata=q20hjosqwyy9opEshah5CZ%2Bp2ca5BOjYIeWlSDHpbUQ%3D&amp;reserved=0