actionscript 3 - How to prevent Textinput under List from capture input -
actionscript 3 - How to prevent Textinput under List from capture input -
when open menu, want textinputs under menu not touchabled.
there 3 textinputs on navigator, when open menu(a list), these textinputs can clecked.
i set navigator.enable=false, when chick overlap part of textinput , menu, textinput hightlight, menu not event.
my code below:
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 logined():boolean { homecoming _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>
thank much.
give 1 of vgroups
id
(e.g. id="txtcontainer"
), enable/disable in _showmainmenu
function:
private function _showmainmenu() : void { if(_ismenuopen == true) { moveout.play(); _ismenuopen = false; navigator.enabled=true; txtcontainer.enabled = true; } else if(_ismenuopen == false) { movein.play(); _ismenuopen = true; navigator.enabled=false; txtcontainer.enabled = false; } }
if still doesn't work, seek setting enabled
property on 3 textinputs
manually in _showmainmenu()
function.
actionscript-3 flex mobile flex4 flexbuilder
Comments
Post a Comment