flex鼠標(biāo)雙擊事件怎么實(shí)現(xiàn)
flex鼠標(biāo)雙擊事件怎么實(shí)現(xiàn)
學(xué)習(xí)前端的同學(xué)你們知道怎么你們知道什么是flex 鼠標(biāo)雙擊事件嗎?不知道的話跟著學(xué)習(xí)啦小編一起來學(xué)習(xí)了解flex 鼠標(biāo)雙擊事件。
flex 鼠標(biāo)雙擊事件的代碼
<?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;
//前后兩次的單擊的時(shí)間
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>
<!-- 將非可視元素(例如服務(wù)、值對(duì)象)放在此處 -->
</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>
鼠標(biāo)雙擊事件相關(guān)文章: