<?xml version="1.0" encoding="utf-8"?>
<TsAbstructTextInput xmlns="cls.com.ils.biz.component.*" xmlns:mx="http://www.adobe.com/2006/mxml"
	focusIn="onFocusIn(event)" focusOut="onFocusOut(event)" 
	doubleClickEnabled="true" doubleClick="onDoubleClick()"
	keyDown="onKeyDown(event)"
	disabledColor="#000000"
	>
	<mx:Script>
		<![CDATA[
			private function onFocusIn(event:FocusEvent):void{

		        var parent:Object = event.currentTarget;

		        for(var i:int = 0; i < 10; i++) {
		            if (parent is AppPanel)
		            {
						if(isZoom){
							//使用可
							parent.zoomEnabled = true;
						}else{
							//使用不可
							parent.zoomEnabled = false;
						}
		                return;
		            }else{
			            parent = parent.parent;	            
		            }
		        }			            								
			}

			private function onFocusOut(event:FocusEvent):void{
				
				if(event.relatedObject is ZoomButton){
					//フォーカスの移動先がズームボタンの場合、何もしない
				}else{
			        var parent:Object = event.currentTarget;
	
		            if (parent is TsTextInput)
		            {

				        for(var i:int = 0; i < 10; i++) {
				            if (parent is AppPanel)
				            {
								//使用不可
								parent.zoomEnabled = false;
				                return;
				            }else{
					            parent = parent.parent;	            
				            }
				        }			            														
		            }
				}
			}
			
			private function onDoubleClick():void{
				var target:InteractiveObject = getFocus();
				if(target.parent == this){
					if(isZoom){
				        var parent:Object = this.document;
		
				        for(var i:int = 0; i < 10; i++) {
				            if (parent is AppPanel)
				            {
				            	parent.zoom(this);
				                return;
				            }else{
					            parent = parent.parent;	            
				            }
				        }			            								
					}				
				}
			}

			// keyDown event handler.
			private function onKeyDown(event:KeyboardEvent):void
			{
				// Ctrl keyを押下したか？
				if (event.ctrlKey){
					switch (event.keyCode) {
					// 下向き矢印キー
					case Keyboard.DOWN :
						if(isZoom){
					        var parent:Object = this.document;
			
					        for(var i:int = 0; i < 10; i++) {
					            if (parent is AppPanel)
					            {
					            	parent.zoom(this);
					                return;
					            }else{
						            parent = parent.parent;	            
					            }
					        }			            								
						}									
						break;
					default :
						break;
					}
				}		

			}
			
		]]>
	</mx:Script>
</TsAbstructTextInput>
