Handle focusIn and focusOut Events : Focus « Components « Flex






Handle focusIn and focusOut Events

Handle focusIn and focusOut Events
           
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:s="library://ns.adobe.com/flex/spark">
    <mx:Script>
        
            import mx.events.FlexMouseEvent;
            [Bindable]
            protected var displayMyPanelFlag:Boolean = false;

            protected function mouseDownOutsideHandler(event:FlexMouseEvent):void {
                if (event.relatedObject != myToggle) {
                    displayMyPanelFlag = false;
                }
            }
      
    </mx:Script>
    <s:ToggleButton id="myToggle" label="Toggle!" x="5" y="5" selected="@{displayMyPanelFlag}"/>
    <s:PopUpAnchor top="115" right="302" displayPopUp="{displayMyPanelFlag}">
        <mx:Panel id="myPanel" mouseDownOutside="mouseDownOutsideHandler(event)"/>
    </s:PopUpAnchor>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Focus management and keyboard controlFocus management and keyboard control
2.Use focus manager to set focus to a controlUse focus manager to set focus to a control