0
當我打開菜單時,我希望菜單下的Textinputs不被觸摸。如何防止捕獲輸入列表下的文本輸入
導航器上有三個Textinput,當我打開菜單(一個列表)時,這些Textinputs可以被清除。
我設置navigator.enable = false,當我小雞重疊區域的Textinput和菜單,Textinput將hightlight,但菜單不會得到事件。
我的代碼如下:
test.mxml
<?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"
applicationComplete="init()" applicationDPI="320">
<fx:Declarations>
<s:Move id="moveIn" duration="200" target="{lateralMenu}" xTo="0"/>
<s:Move id="moveOut" duration="200" target="{lateralMenu}" xTo="{_currentStageWidth - 500}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import spark.events.IndexChangeEvent;
import spark.transitions.CrossFadeViewTransition;
private var _isMenuOpen:Boolean;
[Bindable]
private var _currentStageWidth:Number;
[Bindable]
private var _currentStageHeight:Number;
[Bindable]
private var _logined:Boolean=false;
public function get logined():Boolean { return _logined; }
public function set logined(logined:Boolean):void { _logined=logined; }
private function _onbtnHeaderMenu_ClickHandler(event:MouseEvent):void
{
_showMainMenu();
}
private function _menuBackground_ClickHandler(event:MouseEvent):void
{
_isMenuOpen = false;
moveOut.play();
navigator.enabled=true;
}
public function init():void
{
navigator.defaultPushTransition = new CrossFadeViewTransition();
navigator.defaultPopTransition = new CrossFadeViewTransition();
_currentStageWidth = stage.stageWidth*-1;
lateralMenu.x = _currentStageWidth - 500;
_currentStageHeight = navigator.height - 90;
lateralMenu.height = _currentStageHeight;
_isMenuOpen = false;
}
private function _showMainMenu() : void
{
if(_isMenuOpen == true)
{
moveOut.play();
_isMenuOpen = false;
navigator.enabled=true;
}
else if(_isMenuOpen == false)
{
moveIn.play();
_isMenuOpen = true;
navigator.enabled=false;
}
}
protected function componentsList_changeHandler(event:IndexChangeEvent):void
{
moveOut.play();
_isMenuOpen = false;
navigator.enabled=true;
}
]]>
</fx:Script>
<s:ViewNavigator id="navigator" width="100%" height="100%" firstView="LoginView">
<s:navigationContent>
<s:Button id="btnHeaderMenu" height="90" click="_onbtnHeaderMenu_ClickHandler(event)"/>
<s:Label id="lblHead" width="100%" height="90"
click="_onbtnHeaderMenu_ClickHandler(event)" color="#f7f8f8"
fontFamily="NunitoBold" fontSize="36" paddingLeft="150" text="login"
typographicCase="uppercase" verticalAlign="middle" verticalCenter="0"/>
</s:navigationContent>
</s:ViewNavigator>
<s:Group id="lateralMenu" y="90" width="100%" height="100%">
<s:List id="componentsList" width="500" height="100%" alpha="0.7"
change="componentsList_changeHandler(event)" contentBackgroundAlpha="0.5"
labelField="text">
<s:ArrayCollection id="listMenu">
<fx:Object text="LANGUAGE"/>
<fx:Object text="HOME"/>
<fx:Object text="WOW"/>
<fx:Object text="QUIT"/>
</s:ArrayCollection>
</s:List>
</s:Group>
</s:Application>
LoginView.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Scroller id="scroller" width="100%" height="100%">
<s:VGroup width="100%" height="100%">
<s:VGroup width="100%">
<s:HGroup width="100%">
<s:Label width="200" text="IP(*)"/>
<s:TextInput id="txtIP" width="100%"/>
</s:HGroup>
<s:HGroup width="100%">
<s:Label width="200" text="Username(*)"/>
<s:TextInput id="txtUsr" width="100%"/>
</s:HGroup>
<s:HGroup width="100%">
<s:Label width="200" text="Password"/>
<s:TextInput id="txtPwd" width="100%"/>
</s:HGroup>
</s:VGroup>
<s:Spacer width="100%" height="70%"/>
</s:VGroup>
</s:Scroller>
</s:View>
非常感謝你。