屏蔽掉Accordion控件的键盘事件.
通过重写keyDownHandler()方法实现。
MXML:
comps/MyAccordion.as :
/**
* http://blog.flexexamples.com/2008/06/10/disabling-keyboard-navigation-on-the-accordion-container-in-flex/
*/
package comps {
import mx.containers.Accordion;
import flash.events.KeyboardEvent;
public class MyAccordion extends Accordion {
public function MyAccordion() {
super();
}
override protected function keyDownHandler(evt:KeyboardEvent):void {
}
}
}
* http://blog.flexexamples.com/2008/06/10/disabling-keyboard-navigation-on-the-accordion-container-in-flex/
*/
package comps {
import mx.containers.Accordion;
import flash.events.KeyboardEvent;
public class MyAccordion extends Accordion {
public function MyAccordion() {
super();
}
override protected function keyDownHandler(evt:KeyboardEvent):void {
}
}
}
MXML:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/06/10/disabling-keyboard-navigation-on-the-accordion-container-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comps="comps.*"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<comps:MyAccordion id="accordion"
width="100%"
height="100%">
<mx:VBox id="v1"
label="One"
width="100%"
height="100%">
<mx:Label text="One" />
</mx:VBox>
<mx:VBox id="v2"
label="Two"
width="100%"
height="100%">
<mx:Label text="Two" />
</mx:VBox>
<mx:VBox id="v3"
label="Three"
width="100%"
height="100%">
<mx:Label text="Three" />
</mx:VBox>
<mx:VBox id="v4"
label="Four"
width="100%"
height="100%">
<mx:Label text="Four" />
</mx:VBox>
<mx:VBox id="v5"
label="Five"
width="100%"
height="100%">
<mx:Label text="Five" />
</mx:VBox>
</comps:MyAccordion>
</mx:Application>
<!-- http://blog.flexexamples.com/2008/06/10/disabling-keyboard-navigation-on-the-accordion-container-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comps="comps.*"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<comps:MyAccordion id="accordion"
width="100%"
height="100%">
<mx:VBox id="v1"
label="One"
width="100%"
height="100%">
<mx:Label text="One" />
</mx:VBox>
<mx:VBox id="v2"
label="Two"
width="100%"
height="100%">
<mx:Label text="Two" />
</mx:VBox>
<mx:VBox id="v3"
label="Three"
width="100%"
height="100%">
<mx:Label text="Three" />
</mx:VBox>
<mx:VBox id="v4"
label="Four"
width="100%"
height="100%">
<mx:Label text="Four" />
</mx:VBox>
<mx:VBox id="v5"
label="Five"
width="100%"
height="100%">
<mx:Label text="Five" />
</mx:VBox>
</comps:MyAccordion>
</mx:Application>