Text被双击后,其上面的文字不被选中的代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
internal function initApp():void{
canvas_1.doubleClickEnabled = true;
canvas_1.addEventListener(MouseEvent.DOUBLE_CLICK,DbClickCanvas);
text1.doubleClickEnabled = true;
text1.addEventListener(MouseEvent.DOUBLE_CLICK, DbClickText);
}
internal function output(msg:String):void{
debug_txt.text += msg+"\n";
}
internal function DbClickCanvas(evt:MouseEvent):void{
output("是否冒泡--"+evt.bubbles);
output("目标对象-- "+evt.target+" -- "+evt.eventPhase);
output("遍历对象-- "+evt.currentTarget);
output("------------");
}
internal function DbClickText(evt:MouseEvent):void{
evt.preventDefault();
output("TEXT 是否冒泡--"+evt.bubbles);
output("TEXT 目标对象-- "+evt.target+" -- "+evt.eventPhase);
output("TEXT 遍历对象-- "+evt.currentTarget);
output("TEXT ------------");
}
]]>
</mx:Script>
<mx:Canvas id = "canvas_1" styleName="box" x="37" y="63" width="425" height="160">
<mx:Text id="text1" x="13" y="10" text="Canvas_1"/>
</mx:Canvas>
<mx:TextArea id="debug_txt" styleName="textBox" x="37" y="100" height="298" width="425"/>
</mx:Application>
解决方案:加上selectable="false"就可以了。