flex鼠标双击事件怎么实现
相关话题
学习前端的同学你们知道怎么你们知道什么是flex 鼠标双击事件吗?不知道的话跟着小编一起来学习了解flex 鼠标双击事件。
flex 鼠标双击事件的代码
<?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"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
import flash.utils.getTimer;
import mx.controls.Alert;
private var delay:uint = 300;
//前后两次的单击的时间
private var firstClick:uint;
private var lastClick:uint;
protected function buttonId_mouseWheelHandler(event:MouseEvent):void
{
//buttonId.x = event.delta;
if(firstClick == 0) {
firstClick = getTimer();
myText.text += "firstClick:"+firstClick+"n";
}else {
lastClick = getTimer();
myText.text += "lastClick:"+lastClick+"n";
if(lastClick-firstClick<delay) {
myText.text += lastClick-firstClick+"n";
Alert.show("doubleClick");
}
firstClick = getTimer();
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<!--<s:Button x="258" y="227" label="button" id="buttonId" mouseWheel="buttonId_mouseWheelHandler(event)"/>-->
<s:TextArea id="myText" x="204" y="39"/>
<s:Button x="258" y="227" label="button" id="buttonId" click="buttonId_mouseWheelHandler(event)"/>
</s:Application>
flex鼠标双击事件怎么实现的评论条评论